• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

C++ question

NuclearFusi0n

Diamond Member
Jul 2, 2001
7,028
0
0
how do you throw output a variable of type double with two decimal places? like, i want 2.5 to show up at 2.50
 

SWScorch

Diamond Member
May 13, 2001
9,520
1
76
setprecision(2) I believe, like

cout << setprecision(2) << right << amount << endl;