home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tybc4
/
in1.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-24
|
847b
|
29 lines
// 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;
}