#include #include #include #include #include void main() { cout << setprecision (2) // sets the # of decimal places << setiosflags (ios::fixed) // no scientific notation << setiosflags (ios::showpoint); // show all trailing zeros cout << " 1 2 3 4\n" ; cout << "1234567890123456789012345678901234567890\n" ; cout << " XXXXX NNNNN X NNN.NN \n" ; // Place the data here char name1 [6] = "James" ; int inum = 12345 ; char byte1 = 'J' ; float fnum = 987.65 ; cout << " " << setw(9) << setiosflags (ios::left) << name1 << setw(5) << setiosflags (ios::right) << inum << " " << setw(7) << setiosflags (ios::left) << byte1 << fnum ; /* The problems of loosing trailing zeros, the switch to scientific notation, and the control of the number of digits displayed to the right of the decimal point are interrelated. To solve them, we must use I/O (or Input/Output) manipulators. You can think of an I/O manipulator as an instruction to the cout stream to display numbers in a certain way. */ } // end of main ()