Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Header14-4.h"
- int main()
- {
- const int SIZE = 5;
- using std::cin;
- using std::cout;
- using std::endl;
- using std::strchr;
- Person * arr[SIZE];
- int i;
- for (i = 0; i < SIZE; i++)
- {
- char choice;
- cout << "Wybierz postac: :\n"
- << "g: gunslinger p: poker player "
- << "b: badguy w: wyjscie \n";
- cin >> choice;
- while (strchr("gpbw", choice) == NULL)
- {
- cout << "Wpisz b, p, b lub w";
- cin >> choice;
- }
- if (choice == 'w')
- break;
- while (cin.get() != '\n')
- continue;
- switch (choice)
- {
- case 'g':
- arr[i] = new Gunslinger;
- arr[i]->Set();
- break;
- case 'p':
- arr[i] = new PokerPlayer;
- arr[i]->Set();
- break;
- case'b':
- arr[i] = new BadGuy;
- arr[i]->Set();
- break;
- }
- }
- for (int j = 0; j < i ; i++)
- {
- arr[i]->Show();
- }
- cout << "Koniec\n";
- return 0;
- }
Add Comment
Please, Sign In to add comment