#include #include #include int main() { cout << "Precision(6): " << endl << sqrt(2.0) << endl; cout << sqrt(5.0) << endl << endl; cout.precision(12); cout << "Precision(12): " << endl << sqrt(2.0) << endl; cout << sqrt(5.0) << endl << endl; cout << "Precision(3): " << setprecision(3) << endl << sqrt(2.0) << endl; cout << sqrt(5.0) << endl; cout << endl << "********************************************************" << endl << endl; #if 0 cout << "Scientific: " << scientific << 100.0 << endl << "Fixed decimal: " << fixed << 100.0 << endl; cout << "Scientific: " << scientific << sqrt(2.0) << endl << "Fixed decimal: " << fixed << sqrt(2.0) << endl; cout << endl << "********************************************************" << endl << endl; #endif int n = 27; double d = 8.56; cout << "n = "; cout.width(12); cout << n << endl; cout << "d = "; cout.width(12); cout << d << endl << endl; cout.width(12); cout << "n = " << n << endl << endl; cout << "n = " << setw(12) << n << endl << "d = " << setw(12) << d << endl; return 0; }