Advertisement
zsoltizbekk

fixeded

May 31st, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. int main()
  7. {
  8.     char *sor = malloc (31 * sizeof(char));
  9.     char *akt = malloc (31 * sizeof(char));
  10.     int szam;
  11.  
  12.     int nov = 0;
  13.     int csokk = 1;
  14.  
  15.     int db = 0;
  16.     scanf("%d", &szam);
  17.     while (db != szam+1)
  18.     {
  19.         gets(sor);
  20.         if ( db == 0 )
  21.         {
  22.             strcpy(akt,sor);
  23.         }
  24.         else
  25.         {
  26.             if (strcmp(akt,sor)  > 0 )
  27.             {
  28.                 csokk = csokk + 1;
  29.                 strcpy(akt,sor);
  30.             }
  31.             if (strcmp(akt,sor) < 0 )
  32.             {
  33.                 nov = nov + 1;
  34.                 strcpy(akt,sor);
  35.             }
  36.         }
  37.         db++;
  38.     }
  39.  
  40.     if (nov == db-1) printf("Ordered\n");
  41.     else if (csokk == db-1) printf("Ordered\n");
  42.     else printf("Unordered\n");
  43.  
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement