#include<stdio.h> #include<string.h> struct cha{ char a[100]; }c[3],temp; int main() { int i,j; for(i=0;i<3;i++) scanf("%s",c[i].a); for(i=0;i<2;i++) for(j=0;j<2-i;j++) { if(strcmp(c[j].a,c[j+1].a)>0) { temp=c[j]; c[j]=c[j+1]; c[j+1]=temp; } } for(i=0;i<3;i++) printf("%s\n",c[i].a); } |
Double click to view unformatted code.