: : hi i'm new in c++
: : and i need some help to output 2 decimal places in float.
: : example:
: : if the output is 9.9(float) i want to be 9.90(float)
: : or 35(float) i want to be 35.00(float)
: : and so on.
And now the way you're solving problems like that in C++:
#include <iomanip> //that's the header file you need in this
using namespace std;
float f = 9.9;
cout << setprecision (2) << f << endl;
Now let's just say something about the source code you might understand but which functions you don't know!
`setprecision ()' is a so called IO-Manipulator (therefor he stands in the iomanip!)
You might want to take a look at a reference of the c++ standard library! For example: http://www.cplusplus.com/ref/iostream/iomanip/index.html