You need to include <iomanip>
and provide namespace scope to setw and setprecision
#include <iomanip>
std::setw(2)
std::setprecision(5)
try:
cout.precision(5);
cout << "Total : " << setw(4) << floor(total*100)/100 << endl;
or
cout << "Total : " << setw(4) << ceil(total*10)/10 << endl;
iostream provides precision function, but to use setw, you may need to include extra header file.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…