Question
Program needs to be in C++ Please use the code below and modify it Code to use: #include enum RPS{ Rock, Paper, Scissors }; //
Program needs to be in C++
Please use the code below and modify it
Code to use:
#include
enum RPS{ Rock, Paper, Scissors }; // Rock = 1, Paper = 2, Scissors = 3;
class RPS_player_c{ protected: std::string name; public: // create a pure virtual "turn" function std::string getName(){return name;} };
class userPlayer_c /* derived class of RPS_player_c */{
public: int turn(){ // The user will put in a 0 for Rock, 1 for Paper, and 2 for Scissors // Don't let the value be anything other than 0, 1, or 2 } userPlayer_c(std::string name){this->name = name;}
};
class compPlayer_c : public RPS_player_c{
public: int turn(){ // Computer will choose randomly between 0, 1, or 2 } compPlayer_c(){this->name = "Computer";} };
int main(){
// Create two objects, one of each // Must use an array and pointers int another = 1; int winner = 0; do{ // User and Computer need to take a turn/throw if(userThrow == compThrow){ std::cout > another; }while(another);
return 0; }
1 2 E/ /********** This program is meant to produce a Rock Paper Scissors game. A base player of a name, a getName, and a pure virtual turn function needs to be created. 3 Refer below to beginning a base class and main. You will need to make derived classes and fill what is needed. 4 5 6 **********/ 7 8 #includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started