View Code of Problem 78

#include<stdio.h>
#include<string.h>
typedef	struct {
	char a[100];
}Str;

void main() {
	Str s[3],temp;
	int i,j;
	for(i=0; i<3; i++) {
		scanf("%s",&s[i].a);
	}
	for(i=0; i<3; i++) {
		for(j=i; j<3; j++) {
			if(strcmp(s[i].a,s[j].a)>0) {
				temp=s[i];
				s[i]=s[j];
				s[j]=temp;
			}
		}
	}
	for(i=0; i<3; i++) {
		printf("%s\n",s[i].a);
	}
}

Double click to view unformatted code.


Back to problem 78