I'm pretty new to c++ and I've been trying to create this rock paper scissors game where you can enter the word for what you chose and play against a computer. Although I am entering either rock, paper, or scissors exactly, it always goes to default in the last switch statement and says error. I have no idea what the problem is. Anybody here know what the error may be? I'm using online gbd to compile and execute the code.
Oh, good catch. And also, note that on lines 40-48, you assign pNumb a new value, but then you never actually use pNumb again. If you want numbDiff to have an updated value, you need to assign to numbDiff after you assign to pNumb.
Eraun, I'm curious, did you think that numbDiff = rando - pNumb would cause numbDiff to be updated when pNumb was updated? I've seen many beginners assign values to variables too early and I wonder if they think that C++ programs work like spreadsheet formulas, where the value automatically updates when a component of the formula updates.
but then check for r, p, or s.
. That's okay. r, p, and s are strings with the values "rock" "paper" and "scissors". See lines 21-23