Set fixed flag for double value
#include <iostream>
using namespace std;
int main()
{
int x = 100;
double f = 98.6;
double f2 = 123456.0;
double f3 = 1234567.0;
cout.setf(ios::fixed, ios::floatfield);
cout << "After setting fixed flag:\n";
cout << "f: " << f << " f2: " << f2 << " f3: " << f3 << "\n\n";
return 0;
}
Related examples in the same category