So, i'm new to all this stuff and not used to c++ yet. My problem here is that when i enter 0-2 it works perfectly fine but when i put in anything greater than 2, i don't get the default message. I feel like it because of the "breaks;" but i'm not exactly sure. I've tried adding brackets and breaks in different spots. Im using a random number generator for the computers input and switch statements. Help please!
Please use coding tags, edit your post and put ["code"] and ["/code"] tags around your code, not including the quotation marks.
You never get to the default: label because your "compn" variable will always be 0, 1, or 2 no matter what the user says as "choice".
To fix it,
I would do the opposite logic for your program, instead of switching on compn, do a switch statement for choice, and then in each branch, do
1 2 3 4 5 6
if (comp == 0)
...
elseif (comp == 1)
...
else // compn is 2
...
Thanks, i switched the choice instead and it started working. i was sitting around for hours trying to figure this out and btw where do i put the coding tags i got a little confused with that.