#include #include #include #include #include // Windows系统需要这个头文件来设置控制台编码using namespace std;class RockPaperScissors {private:int playerScore;int computerScore;int rounds;string getComputerChoice {int choice = rand % 3;switch (choice) {case 0: return "rock";case 1: return "scissors";case 2: return "paper";default: return "rock";}}string getChineseChoice(const string& choice) {if (choice == "rock") return "石头";if (choice == "scissors") return "剪刀";if (choice == "paper") return "布";return "";}bool determineWinner(const string& playerChoice, const string& computerChoice) {if (playerChoice == computerChoice) {cout 0) {string playerInput;cout > playerInput;if (!isValidChoice(playerInput)) {cout computerScore) {cout > playAgain;if (playAgain == 'y' || playAgain == 'Y') {game.resetGame;cout摘要:#include #include #include #include #include // Windows系统需要这个头文件来设置控制台编码using namesp
来源:生活小乐趣
免责声明:本站系转载,并不代表本网赞同其观点和对其真实性负责。如涉及作品内容、版权和其它问题,请在30日内与本站联系,我们将在第一时间删除内容!