#include<stdio.h> #include<algorithm> #include<iostream> #include<string.h> using namespace std; int main() { char a[3][100],temp[1000]; gets(a[0]); gets(a[1]); gets(a[2]); int k; for(int i=0;i<3;i++) { k=i; for(int j=i;j<3;j++) { if(strcmp(a[k],a[j])>0) k=j; } strcpy(temp,a[i]); strcpy(a[i],a[k]); strcpy(a[k],temp); } for(int i=0;i<3;i++) { if(i!=2) cout<<a[i]<<endl; else cout<<a[i]; } return 0; } |
Double click to view unformatted code.