View Code of Problem 78

#include<stdio.h>
#include<string.h>
int main()
{
	void swap(char*p1,char*p2);
	char a[10],b[10],c[10];
	gets(a);
	gets(b);
	gets(c);
	if(strcmp(a,b)>0)swap(a,b);
	if(strcmp(a,c)>0)swap(a,c);
	if(strcmp(b,c)>0)swap(b,c);
	puts(a);
	puts(b);
	puts(c);
	return 0;
}
void swap(char *p1,char *p2)
{
	char p[20];
	strcpy(p,p1);
	strcpy(p1,p2);
	strcpy(p2,p);
}

Double click to view unformatted code.


Back to problem 78