# include <stdio.h> # include <string.h> int main(void) { char a[100] , b[100] , c[100] , temp[100]; gets(a);//从键盘读取字符串 gets(b); gets(c); if(strcmp(a,b)>0)//a比b大 { strcpy(temp,a);//交换ab strcpy(a,b); strcpy(b,temp); } if(strcmp(a,c)>0)//a比c大 { strcpy(temp,a);//交换ac strcpy(a,c); strcpy(c,temp); } if(strcmp(b,c)>0)//b比c大 { strcpy(temp,b);//交换bc strcpy(b,c); strcpy(c,temp); } //printf("\n"); puts(a); puts(b); puts(c); return 0; } |
Double click to view unformatted code.