/* Formatting and file: 4ex2.cpp (or used as 4ex2.appended) FALL 1998 ___________________________________ Jacob Y. Kazakia jyk0 September 28, 1998 Programming example 2 of week 4 Recitation Instructor: J.Y.Kazakia Recitation Section 01 ___________________________________ Purpose: This program reads three numbers a, b, and c through the keyboard and outputs them on the screen in various SCIENTIFIC formats. Algorithm: The main idea here is explained on page 114 of the book where the functions: setiosflags, setw, setprecision are explained. ios:: fixed ios:: scientific ios:: showpoint */ #include #include void main() { // variables are typed and defined float a,b,c; // the three numbers cout<<" \n\n Please enter 3 numbers \n a = "; cin>>a; cout<<"\n b = "; cin>>b; cout<<"\n c = "; cin>>c; // Output everything in scientific form cout<>w; } /* THESE ARE SOME OF THE OUTPUTS Please enter 3 numbers a = 0.0000000000001 b = 123456789.45678 c = -4567.0000000045 With precision 5 and width 20 1 2 3 4 5 12345678901234567890123456789012345678901234567890 1.00000e-13 1.23457e+08 -4.56700e+03 With precision 3 and width 10 1 2 3 4 5 12345678901234567890123456789012345678901234567890 1.000e-13 1.235e+08-4.567e+03 enter e (exit) to terminate the program.... ************************************************************ ************************************************************** Please enter 3 numbers a = 123 b = 12 c = 0.6789 With precision 5 and width 20 1 2 3 4 5 12345678901234567890123456789012345678901234567890 1.23000e+02 1.20000e+01 6.78900e-01 With precision 3 and width 10 1 2 3 4 5 12345678901234567890123456789012345678901234567890 1.230e+02 1.200e+01 6.789e-01 enter e (exit) to terminate the program....e */