My problem is that for the text based RPS game that I'm making won't display if they won or not. I have the random code.
#include <ctime> int compSelection compSelection = rand() % (3 + 1);
I also tried
compSelection = 1 + rand() % (3 + 1);
I believe either of those would for for the way I'm doing it. But I'm not sure if thats the problem, but then after that I had was looking through my code and realized that I'm not sure which way would work better or which wouldn't work at all. For determining who wins. I had both of these kinda codes.
Case(compSelection) Case '1': If Else If Else If Else break; Case '2': If Else If ... and so on.
Then I tried
If(userSelection == "R") Case(compSelection)
doing it that way I would have needed 3 or 4 case statements, so I thought that the first way would have worked better.
Anyways, both ways I did it, I came up with the same problem.
I'd have the user enter their name and then once they did that the Letter choice(I did a capital R so my code wouldn't have to capitalize it until I got started on it and working properly.
Once they did that, the program would run the default of the case, so I took that out and it wouldn't display anything. just the "Press any button to continue" line at the end of the command problem.
I don't know I've re-read my code like 100 times and I can't find anything that would cause that. I'm building it in Visual Studio 2003. I build or rebuild then run without debug.(only way the properly works at my school)
So can anyone help me out a little bit and help me get this fixed. I don't understand what it could be. I don't have any build errors and it builds perfectly fine.
P.S., sorry I couldn't provide the code so you can see exactly what my problem is. I know my teacher browsers this from time to time and I don't want a fix someone else does, I want one that I do so I can figure out what I did wrong and learn from it.