View Code of Problem 78

#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++ ){
		char temp[20];
		for( int j=i+1; j<3; j++ ){
			if( strcmp(s[i],s[j])> 0 ){
				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.


Back to problem 78