Advertisement
AnaGocevska

Untitled

Mar 29th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.96 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. typedef struct Tanc
  5. {
  6.     char ime[15];
  7.     char zemja[15];
  8. }Tanc;
  9.  
  10. typedef struct Tancer
  11. {
  12.     char ime[20];
  13.     char prezime[20];
  14.     Tanc tanci[5];
  15. }Tancer;
  16.  
  17. void tancuvanje(Tancer *t, int n, char *zemja)
  18. {
  19.     int i;
  20.     for(i=0; i<n; i++)
  21.     {
  22.         int j;
  23.         for(j=0; j<5; j++)
  24.         {
  25.             if(strcmp(t[i].tanci[j].zemja, zemja)==0)
  26.             {
  27.                 printf("%s %s %s\n", t[i].ime, t[i].prezime, t[i].tanci[j].ime);
  28.                 break;
  29.             }
  30.         }
  31.     }
  32. }
  33.  
  34. int main()
  35. {
  36.     int n;
  37.     scanf("%d", &n);
  38.     int i;
  39.     Tancer t[n];
  40.     for(i=0; i<n; i++)
  41.     {
  42.         scanf("%s", &t[i].ime);
  43.         scanf("%s", &t[i].prezime);
  44.         int j;
  45.         for(j=0; j<5; j++)
  46.         {
  47.             scanf("%s", &t[i].tanci[j].ime);
  48.             scanf("%s", &t[i].tanci[j].zemja);
  49.         }
  50.     }
  51.  char zemja[100];
  52.  scanf("%s", &zemja);
  53.  tancuvanje(t, n, zemja);
  54.  return 0;
  55.    
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement