According to the documentation, setprecision(2) would arrange that. The rest of the padding you'd use setw() for.