I'm trying to Run a program that converts Currency From KD to DOLLAR and EURO.
The problem is I'm expecting the output to be with 3 floating numbers but the actual out put is just 1 floating number after the decimal point like the pi.
I'm trying to Run a program that converts Currency From KD to DOLLAR and EURO.
The problem is I'm expecting the output to be with 3 floating numbers but the actual out put is just 1 floating number after the decimal point like the pi.
std::fixed should solve your issue :
double a = 3.149;
std::cout << std::setprecision(6) << std::fixed << a << "\n";
will output :
3.149000