0
How to get precision in C++?
Im trying to the get the precision to be to the 0.01 but seriously do not know what to do... Im using array by the way
2 ответов
+ 4
An example would better. Anyway for precision use
setprecision function like
float x,y,z;
x = 11;
y = 7;
z = x/y;
cout<<setprecision(3)<<z<<endl;
output:
1.57
Remember this is not a full code, rest of code you have to write yourself. I am just showing a way.
You have to include iomanip header file.
0
Thanks!. Helped a lot in the code I was doing.