geekbrains_oop_cpp/lesson_7/exercise_5.cpp

34 lines
575 B
C++
Raw Normal View History

2021-07-11 19:42:53 +00:00
#include "Blackjack.hpp"
void exercise_5()
{
cout << "\t\tWelcome to Blackjack!\n\n";
int numPlayers = 0;
while (numPlayers < 1 || numPlayers > 7)
{
cout << "How many players? (1 - 7): ";
cin >> numPlayers;
}
vector<string> names;
string name;
for (int i = 0; i < numPlayers; ++i)
{
cout << "Enter player name: ";
cin >> name;
names.push_back(name);
}
cout << endl;
//the game loop
Game aGame(names);
char again = 'y';
while (again != 'n' && again != 'N')
{
aGame.Play();
cout << "\nDo you want to play again? (Y/N): ";
cin >> again;
}
}