-2

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.

enter image description here

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190

1 Answers1

1

std::fixed should solve your issue :

double a = 3.149;

std::cout <<  std::setprecision(6) << std::fixed << a << "\n";

will output :

3.149000

willll
  • 1,809
  • 1
  • 16
  • 23