c++

Can someone help me get started with this RockPaperScissors Game

* Requires: player_number is either 1 or 2
* Modifies: cout, cin
* Effects: Prompts the user to enter their name. Names entered may
* have spaces within them.
* Example: "Kermit the frog"
*
* If an empty name is given, this is invalid input, so print
* error message 1, and return a default name.
* For player 1, the default name is: Rocky
* For player 2, the default name is: Creed
* Prompt: Player [player_number], enter your name:
*/
string getName(int player_number)

* Requires: player_name is the name of the player being prompted for their
* move.
* Modifies: cout, cin
* Effects: Prompts the player for their move and returns it.
* This function should accept the first non-whitespace character as
* the move. If an illegal character is entered for their move, print
* error message 2 and return rock as a default. You can assume a user
* will enter a single character, and nothing else, as their move.
* Prompt: [player_name], enter your move:
*/
char getMove(string player_name);

/**
* Requires: move is the move of the player being checked for a win.
* opponent_move is the move of the opponent.
* both move and opponent_move are valid moves.
* Modifies: nothing
* Effects: Returns true if and only if the player who made move won
* according to the rules to rock-paper-scissors. Returns false
* otherwise.
*/
bool isRoundWinner(char move, char opponent_move);
Hello offset221,

The following gives you a place to start:

* Requires: player_number is either 1 or 2
* Modifies: cout, cin
* Effects: Prompts the user to enter their name. Names entered may
* have spaces within them.
* Example: "Kermit the frog"
*
* If an empty name is given, this is invalid input, so print
* error message 1, and return a default name.
* For player 1, the default name is: Rocky
* For player 2, the default name is: Creed
* Prompt: Player [player_number], enter your name:
*/
string getName(int player_number)

This tells you at least one variable that you will have, something that represents a "player_number", not that you have to use exactly as is, but something similar.

It also tells you that you will need a function to get the input.

Start with this portion and get it working before you move on.

Hope that helps,

Andy
Topic archived. No new replies allowed.