D
D
dorofey11112021-10-09 15:05:08
C++ / C#
dorofey1111, 2021-10-09 15:05:08

How to reduce the number of digits after the decimal point in C++ output?

The result is 3.9616316
Need to get only 2 digits after the dot on the output?
Just learning C++

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danila Kravchenko, 2021-10-09
@dorofey1111

double a=10.345724;
cout << setprecision(2) << fixed << a << endl;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question