Leedwon

Untitled

May 24th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include "Header14-4.h"
  2.  
  3. int main()
  4. {
  5.     const int SIZE = 5;
  6.     using std::cin;
  7.     using std::cout;
  8.     using std::endl;       
  9.     using std::strchr;
  10.  
  11.     Person * arr[SIZE];
  12.     int i;
  13.     for (i = 0; i < SIZE; i++)
  14.     {  
  15.         char choice;
  16.         cout << "Wybierz postac: :\n"
  17.         << "g: gunslinger p: poker player "
  18.         << "b: badguy w: wyjscie \n";
  19.         cin >> choice;
  20.         while (strchr("gpbw", choice) == NULL)
  21.         {
  22.             cout << "Wpisz b, p, b lub w";
  23.             cin >> choice;
  24.         }
  25.         if (choice == 'w')
  26.             break;
  27.         while (cin.get() != '\n')
  28.             continue;
  29.         switch (choice)
  30.         {
  31.         case 'g':
  32.             arr[i] = new Gunslinger;
  33.             arr[i]->Set();
  34.             break;
  35.         case 'p':
  36.             arr[i] = new PokerPlayer;
  37.             arr[i]->Set();
  38.             break;
  39.         case'b':
  40.             arr[i] = new BadGuy;
  41.             arr[i]->Set();
  42.             break;
  43.         }
  44.     }
  45.         for (int j = 0; j < i ; i++)
  46.         {
  47.             arr[i]->Show();
  48.         }
  49.             cout << "Koniec\n";
  50. return 0;
  51. }
Add Comment
Please, Sign In to add comment