这是一些代码:
void main()
{
GameEngine ge("phil", "anotherguy");
string response;
do {
ge.playGame();
cout << endl << "Do you want to (r)eplay the same battle, (s)tart a new battle, or (q)uit? ";
cin >> response;
} while(response == "r" || response == "R" || response == "s" || response == "S" );
}
GameEngine::GameEngine(string name1, string name2)
{
p1Name = name1;
p2Name = name2;
}
void GameEngine::playGame()
{
cout << "PLAY GAME" << endl;
Army p1, p2;
Battlefield testField;
RuleSet rs; …Run Code Online (Sandbox Code Playgroud)