View Code of Problem 78

#include<stdio.h>
#include<string.h>
int main(){
    void swap(char *p1,char *p2);
    char a[100],b[100],c[100];
    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);
    printf("%s\n%s\n%s\n",a,b,c);
    return 0;
}
void swap(char *p1,char *p2){
    char temp[100];
    strcpy(temp,p1);
    strcpy(p1,p2);
    strcpy(p2,temp);
}

Double click to view unformatted code.


Back to problem 78