Hello. I would like to be told how to format the decimals of a float variable.
In C, you just do it like this: printf("The number is %3.2f",x);
It gives you 3 places for the number before the decimal point and 2 for the decimals (it gives more then 3 if the number is longer). This is useful if the number is for ex 5.123456 and it will print out 5.12. How to do this in C++? I wrote a program in C++, but when I had to format the decimals, I used a C line. That is not the solution though. Thanks for your answer.