# include<stdio.h> # include<string.h> void swap( char str1[],char str2[]){ char temp[100]; strcpy(temp,str1); strcpy(str1,str2); strcpy(str2,temp); } int main(){ char str1[100],str2[100],str3[100]; gets(str1); gets(str2); gets(str3); int cmp=strcmp(str1,str2); if(cmp>0){ swap(str1,str2); } cmp= strcmp(str1,str3); if(cmp>0){ swap(str1,str3); } cmp=strcmp(str2,str3); if(cmp>0){ swap(str2,str3); } puts(str1); puts(str2); puts(str3); return 0; } |
Double click to view unformatted code.