I am new in C++
, i just want to output my point number up to 2 digits. just like if number is 3.444
, then the output should be 3.44
or if number is 99999.4234
then output should be 99999.42
, How can i do that. the value is dynamic. Here 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.