-4

I need to write a simple program, which would round off double number to just 2 decimal places. Example: input - 0.3333333, 124.132001 output - 0.33, 124.13

1 Answers1

0

Use std::set_precision as in

std::cout << std::fixed << std::setprecision(2) << 0.3333333;
Goswin von Brederlow
  • 11,875
  • 2
  • 24
  • 42