previous |
start |
next
Example 6
1
2
3
4
5
6
7 #include <iostream>
8 #include <string>
9
10 using namespace std;
11
12 int main()
13 {
14 string fname;
15 string lname;
16
17 cout << "This program prints out your name"
18 << " in a little box.";
19 cout << "\nFirst name: ";
20 cin >> fname;
21 cout << "\nLast name: ";
22 cin >> lname;
23
24 cout << "\nFirst name has length " << fname.length() << endl;;
25 cout << "Last name has length " << lname.length() << endl << endl;
26
27
28 cout << "\t********************" << endl;
29 cout << "\t* " << lname << ", " << fname << " *" << endl;
30 cout << "\t********************" << endl;
31
32
33 return 0;
34 }
previous |
start |
next