exercises 3.4

 1 #include <iostream>
 2 #include <string>
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using std::cout;
 5 using std::cin;
 6 using std::endl;
 7 using std::string;
 8 
 9 int main(int argc, char** argv) {
10     
11     string temp1,temp2;
12     cin>>temp1>>temp2;
13 
14     if(temp1==temp2){
15         cout<<"the same"<<endl;
16     }else if(temp1>temp2){
17         cout<<"temp1>temp2"<<endl;
18     }else{
19         cout<<"temp1<temp2"<<endl;
20     }
21 
22     if(temp1.size()>temp2.size()){
23         cout<<"temp1 is longer"<<endl;
24     }else if(temp1.size()<temp2.size()){
25         cout<<"temp2 is longer"<<endl;
26     }else{
27         cout<<"the same"<<endl;
28     }
29     return 0;
30 }

 

posted @ 2015-04-16 09:26  无敌烤皮蛋  阅读(84)  评论(0)    收藏  举报