1 #include
2 #include
3 using namespace std;
4 void strswap(char *&p,char *&q){
5 char *temp;
6 temp=p;
7 p=q;
8 q=temp;
9 }
10 int main(){
11 #ifdef ONLINE_JUDGE
12 #else
13 freopen("in.txt","r",stdin);
14 #endif
15 char a[3][20],*p[3];
16 for(int i=0;i<3;i++){
17 cin>>a[i];//或cin.getline(a[i],20);
18 p[i]=a[i];
19 }
20 if(strcmp(p[0],p[1])>0) strswap(p[0],p[1]);
21 if(strcmp(p[0],p[2])>0) strswap(p[0],p[2]);
22 if(strcmp(p[1],p[2])>0) strswap(p[1],p[2]);
23 puts(p[0]);
24 puts(p[1]);
25 cout<
26 return 0;
27 }
标签:20,puts,temp,C语言,char,10.15,strcmp,从小到大,strswap
来源: https://www.cnblogs.com/gentlebreeze/p/14276698.html