rounding decimal numbers

Hi forum i need help with rounding of numbers i have some array of numbers type float and i need fix it
for example
1
2
 float f1=5.558;
float f2=5.1;

to f1=5.558,f2=5.100
values from array are different and i need all edit to 3 decimal places
ty and sorry for my english
You may want to look into using some of the functions from the <iomanip> header file since it looks like a display issue.

Yes I tried function from <iomanip> concretely

cout<<setprecision(3)<<f1;
But its not result for me
You'll probably also want to use "fixed" and possibly "showpoint"

http://www.cplusplus.com/reference/ios/showpoint/

If that doesn't help you'll need to show the code that illustrating what you're trying to do and ask specific questions based on that code.
Topic archived. No new replies allowed.