-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3-04.cpp
More file actions
43 lines (34 loc) · 697 Bytes
/
Copy path3-04.cpp
File metadata and controls
43 lines (34 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* 1 */
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str1, str2;
cout << "Please enter two words:" << endl;
cin >> str1 >> str2;
if (str1 > str2)
cout << str1 << endl;
else if (str1 < str2)
cout << str2 << endl;
else
cout << "same" << endl;
return 0;
}
/* 2 */
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str1, str2;
cout << "Please enter two words:" << endl;
cin >> str1 >> str2;
if (str1.size() > str2.size())
cout << str1 << endl;
else if (str1.size() < str2.size())
cout << str2 << endl;
else
cout << "same" << endl;
return 0;
}