LISTING17.3 Multiple Input
0: //Listing 17.3 - character strings and cin
1:
2: #include <iostream>
3: using namespace std;
4:
5: int main()
6: {
7: int myInt;
8: long myLong;
9: double myDouble;
10: float myFloat;
11: unsigned int myUnsigned;
12: char myWord[50];
13:
14: cout << “int: “;
15: cin >> myInt;
16: cout << “Long: “;
17: cin >> myLong;
18: cout << “Double: “;
19: cin >> myDouble;
20: cout << “Float: “;
21: cin >> myFloat;
22: cout << “Word: “;
23: cin >> myWord;
24: cout << “Unsigned: “;
25: cin >> myUnsigned;
26:
27: cout << “\n\nInt:\t” << myInt << endl;
28: cout << “Long:\t” << myLong << endl;
29: cout << “Double:\t” << myDouble << endl;
30: cout << “Float:\t” << myFloat << endl;
31: cout << “Word: \t” << myWord << endl;
32: cout << “Unsigned:\t” << myUnsigned << endl;
33:
34: cout << “\n\nInt, Long, Double, Float, Word, Unsigned: “;
35: cin >> myInt >> myLong >> myDouble;
36: cin >> myFloat >> myWord >> myUnsigned;
37: cout << “\n\nInt:\t” << myInt << endl;
38: cout << “Long:\t” << myLong << endl;
39: cout << “Double:\t” << myDouble << endl;
40: cout << “Float:\t” << myFloat << endl;
41: cout << “Word: \t” << myWord << endl;
42: cout << “Unsigned:\t” << myUnsigned << endl;
43:
44: return 0;
45: }
602 Day 17