View Code of Problem 78

   gets(b);
   gets(c);
   if (strcmp(a,b)>0)
   {
       strcpy(temp,a);
       strcpy(a,b);
       strcpy(b,temp);
   }
   if(strcmp(a,c)>0)
   {
        strcpy(temp,a);
       strcpy(a,c);
       strcpy(c,temp);
   }
   if(strcmp(a,b)>0)
   {
       strcpy(temp,a);
       strcpy(a,b);
       strcpy(b,temp);

   }
   printf("%s\n",a);
     printf("%s\n",b);
       printf("%s\n",c);






}
/*
Main.c:1:4: warning: data definition has no type or storage class
    gets(b);
    ^
Main.c:1:4: warning: type defaults to 'int' in declaration of 'gets'
Main.c:1:4: warning: parameter names (without types) in function declaration
Main.c:2:4: warning: data definition has no type or storage class
    gets(c);
    ^
Main.c:2:4: warning: type defaults to 'int' in declaration of 'gets'
Main.c:2:4: warning: parameter names (without types) in function declaration
Main.c:3:4: error: expected identifier or '(' before 'if'
    if (strcmp(a,b)>0)
    ^
Main.c:9:4: error: expected identifier or '(' before 'if'
    if(strcmp(a,c)>0)
    ^
Main.c:15:4: error: expected identifier or '(' before 'if'
    if(strcmp(a,b)>0)
    ^
Main.c:22:11: error: expected declaration specifiers or '...' before string constant
    printf("%s\n",a);
           ^
Main.c:22:18: error: unknown type name 'a'
    printf("%s\n",a);
                  ^
Main.c:23:13: error: expected declaration specifiers or '...' before string constant
      printf("%s\n",b);
             ^
Main.c:23:20: error: unknown type name 'b'
      printf("%s\n",b);
                    ^
Main.c:24:15: error: expected declaration specifiers or '...' before string constant
        printf("%s\n",c);
               ^
Main.c:24:22: error: unknown type name 'c'
        printf("%s\n",c);
                      ^
Main.c:31:1: error: expected identifier or '(' before '}' token
 }
 ^
*/

Double click to view unformatted code.


Back to problem 78