B
bintom
Say, I have the following lines in my program:
cout << setw(8) << 23.56 << "\n";
cout << setw(8) << 7043.345 << "\n";
cout << setw(8) << 85;
The above program outputs
23.56
7043.35
85
I want the output to be formatted so that each number is displayed to
exactly 2 decimal places and is right aligned as shown below:
23.56
7043.35
85.00
How do I get this done?
Bintom
cout << setw(8) << 23.56 << "\n";
cout << setw(8) << 7043.345 << "\n";
cout << setw(8) << 85;
The above program outputs
23.56
7043.35
85
I want the output to be formatted so that each number is displayed to
exactly 2 decimal places and is right aligned as shown below:
23.56
7043.35
85.00
How do I get this done?
Bintom