home *** CD-ROM | disk | FTP | other *** search
- // Program illustrates standard stream input
-
- #include <iostream.h>
-
- main()
- {
- double x, y, z, sum;
- char c1, c2, c3;
-
- cout << "Enter three numbers separated by a space : ";
- cin >> x >> y >> z;
- sum = x + y + z;
- cout << "Sum of numbers = " << sum
- << "\nAverage of numbers = " << sum / 2 << "\n";
- cout << "Enter three characters : ";
- cin >> c1 >> c2 >> c3;
- cout << "You entered characters '" << c1
- << "', '" << c2 << "', and '"
- << c3 << "'\n";
- cout << "Enter a number, a character, and a number : ";
- cin >> x >> c1 >> y;
- cout << "You entered " << x << " " << c1 << " " << y << "\n";
- cout << "Enter a character, a number, and a character : ";
- cin >> c1 >> x >> c2;
- cout << "You entered " << c1 << " " << x << " " << c2 << "\n";
-
- return 0;
- }
-