Advertisement
WladcaTejKrainy

Untitled

Dec 6th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct przy{
  5.     char wyksz;
  6.     string imie;
  7. };
  8.  
  9. int main() {
  10. int n;
  11. cin >> n;
  12. przy tab[n];
  13. for(int i=0;i<n;i++){
  14.     cin >> tab[i].imie >> tab[i].wyksz;
  15. }
  16. string c;
  17. cin >> c;
  18. for(int i=0;i<n;i++){
  19.     if(c=="w") cout << tab[i].imie<<endl;
  20.     if(c=="s"){
  21.         if(tab[i].wyksz='p') cout << tab[i].imie <<endl;
  22.         if(tab[i].wyksz='s') cout << tab[i].imie <<endl;
  23.         if(tab[i].wyksz='g') cout << tab[i].imie <<endl;
  24.     }
  25.     if(c=="g"){
  26.         if(tab[i].wyksz='p') cout << tab[i].imie <<endl;
  27.         if(tab[i].wyksz='g') cout << tab[i].imie <<endl;
  28.     }
  29.     if(c=="p"){
  30.         if(tab[i].wyksz='p') cout << tab[i].imie <<endl;
  31. }
  32. }
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement