whit@granite:~/public_html/cpsc146/Samples[?1034h[whit@granite Samples]$ cat trunc.cpp #include #include using namespace std; int main() { float x; cout << "Enter a floating point number => "; cin >> x; cout << "without formatting x is: " << x << endl; cout << "formatted with fixed, showpoint and setprecion(2) x is: " ; cout << fixed << showpoint << setprecision(2)<< x << endl; cout << "after formatting x is: " << x << endl; return 0; } whit@granite:~/public_html/cpsc146/Samples[whit@granite Samples]$ ./a.out Enter a floating point number => 1234.6789 without formatting x is: 1234.68 formatted with fixed, showpoint and setprecion(2) x is: 1234.68 after formatting x is: 1234.68 whit@granite:~/public_html/cpsc146/Samples[whit@granite Samples]$ ./a.out Enter a floating point number => 4.5678 without formatting x is: 4.5678 formatted with fixed, showpoint and setprecion(2) x is: 4.57 after formatting x is: 4.57 whit@granite:~/public_html/cpsc146/Samples[whit@granite Samples]$ ./a.out Enter a floating point number => 1.23456789 without formatting x is: 1.23457 formatted with fixed, showpoint and setprecion(2) x is: 1.23 after formatting x is: 1.23