Advertisement
mostlabs

14-2-3

May 12th, 2020
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5.  
  6. using namespace std;
  7. void siralama(struct al *a );
  8. struct al
  9. {
  10.     string country;
  11.     string city;
  12.  
  13. };
  14. int main()
  15. {
  16.  
  17.     struct al a[100];
  18.  
  19.     for(int i=0; i < 26; i++){
  20.          cout << "country" << i+1 <<":";
  21.     cin >> a[i].country;
  22.           cout << "city" << i+1 << ":";
  23.     cin >> a[i].city;
  24.     }
  25.  
  26.     siralama(&a[0]);
  27.     return 0;
  28. }
  29. void siralama(struct al *a ){
  30.  
  31.  
  32.  
  33.     for(int i=0; i < 26; i++){
  34.  
  35.        if((*(a+i)).country == "italy"){
  36.  
  37.            cout <<"italy-city:" << (*(a+i)).city << endl;
  38.        }
  39.  
  40.  
  41.     }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement