I'm new to C++ and all I want to do is print my point number up to two digits.
For example, if the number is 3.444, the output should be 3.44, and if the number is 99999.4234, the output should be 99999.42.
How am I going to do that?
The value changes over time.
This is my code.
#include <iomanip.h>
#include <iomanip>
int main()
{
double num1 = 3.12345678;
cout << fixed << showpoint;
cout << setprecision(2);
cout << num1 << endl;
}
but its giving me an error, undefined fixed symbol.