I'm workking on making a Rock, Paper Scissors text-based game in C++, and I have an if Statement that just keeps giving back whatever the last value is.
Actually do? It gets the user's answer, but why do I need a the while loop?
And what does pChoice.push_back(ch); do? I'm new to C++ and I want to be helped so I can prevent things like this. Not given the answer
First, all the conditional statements will all return true because only one side of the OR must be true. The constant / literal ("Rock", "Paper", "Scissors") on the right side of the OR will always be true, therefore the entire statement will evaluate to true.
Second, you are not using 'else if' statements so the first 'if' evaluates to true and ipChoice = 1, then the second 'if' statement evaluates to true and ipChoice = 2, and the same for the third 'if' statement when ipChoice = 3. The final 'else' is not entered. In the end ipChoice will always = 3.