Guest User

Untitled

a guest
Jan 13th, 2017
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. bool add_player(vector<Player> &player_vector)
  2. {
  3.     string name;
  4.     string comp_name;
  5.     getline(cin, name);
  6.     system("CLS");
  7.     cout << "Podaj login gracza: ";
  8.     getline(cin, name);
  9.     for (int i = 0; i < player_vector.size(); i++)
  10.     {
  11.         comp_name = player_vector[i].get_name();
  12.         if (name.compare(comp_name) == 0)
  13.         {
  14.             cout << endl;
  15.             cout << "Wybrany login jest zajety.";
  16.             Sleep(2000);
  17.             return flase;
  18.         }
  19.     }
  20.     player_vector.push_back(Player(name));
  21.     cout << "Gracz " << name << " pomyslnie dodany do ligi.";
  22.     Sleep(2000);
  23.     return true;
  24. }
  25.  
  26.  
  27.  
  28.  
  29.  
  30. int main()
  31. {
  32. if(add_player(player_vector))
  33. {
  34.  
  35. //if zawsze wpuszcza do srodka bez roznicy co zwraca add_player()
  36.  
  37.  
  38. }
  39.  
  40.  
  41.  
  42. }
Add Comment
Please, Sign In to add comment