#include <stdio.h> #include <string.h> using namespace std; int main(){ char s[4][10]; for( int i=0; i<3; i++ ){ scanf("%s", &s[i]); } for( int i=0; i<3; i++ ){ for( int j=i; j<3; j++ ){ if( strcmp(s[i],s[j])> 0 ){ char temp[10]; strcpy(temp,s[i]); strcpy(s[i],s[j]); strcpy(s[j],temp); } } } for( int i=0; i<3; i++ ){ printf("%s\n", s[i] ); } return 0; } |
Double click to view unformatted code.