CS 150 Introduction to C++
Programming - Spring 1998
|
[ Home |
Lecture Notes| WebTutor
| WebTutor Site Map]
Formatting Output (Exercise 7 Chapter 3)
Given the
following program, tell the output of each line that would
appear on the standard output stream.
#include <iostream.h>
#include <iomanip.h>
int main()
{
char ch;
int n;
float y;
ch = 'A';
cout << ch;
ch = 'b';
cout << ch << endl;
n = 413;
y = 21.8;
cout << setw(5) << n << " is n" << endl;
cout << setw(7) << y << " is y" << endl;
return 0;
}
Copyright chris wild 1998.
For problems or questions regarding this web contact [Dr. Wild].
Last updated: February 19, 1998.