PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/ http://www.cplusplus.com/articles/z13hAqkS/
Hint: You can edit your post, highlight your code and press the <> formatting button.
You can use the preview button at the bottom to see how it looks.
Working with the program I found that the "if" statements in the "results" function did not work correctly.
1 2 3 4
if (user_Choice == pc_Choice)
userTie();
if (user_Choice == 1)
{
This should be an "else if" not two separate "if" statements. If it is a tie all other "if else if" statements would be checked and a wrong answer could be output. Then the nested "if else if" statements can produce the wrong answer.
I came up with this to correct the problem. See what you think:
Other than a "do while" loop in main and adjusting the output display, putting some blank lines between parts, I did not find any problems with the way the program works.
Hope that helps,
Andy
P.S. You need a choice for four in the function "userChoice()".
Help! on this matter. i tried the option for when the two players are tie and then they need to play the game again, but couldn't figure out how to get it done.
//This program lets the user play the game Rock, Paper, Scissors against the computer.
//The user picks a corresponding number from the main menu.
//A winner is selected using the following rules:
//(1) If one player chooses rock and the other player chooses scissors ----> ROCK WINS!
//(2)- If one player chooses scissors and the other player chooses paper -----> SCISSORS WINS!
//(3)- If one player chooses paper and the other player chooses rock -----> PAPER WINS!
//(4)- If both players make the same choice, the game must be played again to determine the winner.
#include <iostream>
#include <cstdlib>
#include <ctime>
i tried the option for when the two players are tie and then they need to play the game again, but couldn't figure out how to get it done.
I would suggest making game_Rules() a bool function. Return true if the game should be played again. False, if not. Where you call userTie(), return true.
You can enclose your main logic in another do/while loop.
1 2 3 4
do
{ displayMenu();
user_Choose();
} while (game_Rules()); // Keep looping while true
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.