View Code of Problem 78

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

#define N 100

int main()
{
	char min[N], mid[N], max[N], temp[N];
	gets(min);
	gets(mid);
	gets(max);

	if (strcmp(min, mid) > 0)
	{
		strcpy(temp, mid);
		strcpy(mid, min);
		strcpy(min, temp);
	}

	if (strcmp(min, max) > 0)
	{
		strcpy(temp, max);
		strcpy(max, min);
		strcpy(min, temp);
	}

	if (strcmp(mid, max) > 0)
	{
		strcpy(temp, mid);
		strcpy(mid, max);
		strcpy(max, temp);
	}

	puts(min);
	puts(mid);
	puts(max);

	return 0;
}

Double click to view unformatted code.


Back to problem 78