Show two digits after decimal point in c++

Similar topic is already discussed in the forum. But I have some different problem in following code:

double total;
cin >> total;
cout << fixed << setprecision(2) << total;

If I give input as 100.00 then program prints just 100 but not 100.00

How can I print 100.00?

Leave a Comment