Floating Point Comparisons
int x = 12;
double a = 8.98, b = 24.489, c = 1234.8, d = 7.0;
- cout << a;
cout << b;
cout << c;
cout << d;
cout << endl;
- cout << setw(x) << a;
cout << setw(x) << b;
cout << setw(x) << c;
cout << setw(x) << d;
cout << endl;
- cout << setprecision(5);
- cout.setf(ios::showpoint);
- cout.setf(ios::fixed);
2 | 8.98 | 24.489 | 1234.8 | 7 |
3 | 8.98 | 24.489 | 1234.8 | 7 |
4 | 8.9800 | 24.489 | 1234.8 | 7.0000 |
5 | 8.98000 | 24.48900 | 1234.80000 | 7.00000 |
Next page
Previous page
Go to Lesson 4 index.