View Code of Problem 78

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<malloc.h>
#include<string.h>



int main() {
	char a[3][100];
	for (int i = 0;i < 3;i++) {
		scanf("%s", a[i]);
	}

	char t[100];
	for (int i = 2;i > 0;i--) {
		int flag = 1;
		for (int j = 0;j < i;j++) {
			if (strcmp(a[j], a[j + 1])>0) {
				strcpy(t, a[j]);
				strcpy(a[j] , a[j + 1]);
				strcpy(a[j + 1] , t);
				flag = 0;
				
			}
				
		}
		if (flag)
			break;
	}
	for (int i = 0;i < 3;i++) {
		printf("%s\n", a[i]);
	}

}

Double click to view unformatted code.


Back to problem 78