View Code of Problem 78

#include<stdio.h>
#include <string.h>
#include <math.h>
int main(){
	char s[3][100];
	int i,j;
	char temp[100];
	for(i=0;i<3;i++){
		gets(s[i]);
	}
	int k=2;
	for(i=0;i<k;i++){
		for(j=0;j<k;j++){
			if(strcmp(s[j],s[j+1])>0){
				strcpy(temp,s[j]);
				strcpy(s[j],s[j+1]);
				strcpy(s[j+1],temp);
			}
		}
		k--;
		
	}
	for(i=0;i<3;i++){
		puts(s[i]);
	}
	
	printf("\n");
	return 0;
}

Double click to view unformatted code.


Back to problem 78