View Code of Problem 78

#include<stdio.h>
#include <string.h>
#include <math.h>
int main(){
	char c[3][10];
	int i,j;
	int k=2;
	for(i=0;i<3;i++){
		gets(c[i]);
	}
	for(i=0;i<k;i++){
		for(j=0;j<k;j++){
			if(strcmp(c[j],c[j+1])>0){
				char temp[8];
				strcpy(temp,c[j+1]);
				strcpy(c[j+1],c[j]);
				strcpy(c[j],temp);
			}
		}
		k--;
	}
	for(i=0;i<3;i++){
		puts(c[i]);
	}

	printf("\n");
	return 0;
}

Double click to view unformatted code.


Back to problem 78