Be more careful as you write, and try the program out a few times as you're writing it. Don't try to write the whole thing and hope it works, but make incremental changes and see improvement.
1. You have many typos.
1a. You set both ROCK and PAPER to 1.
1b. Many cases of Variable Assignment(=) instead of Check for Equality (==)
1c. One of your win cases was reversed (rock should beat scissors)
1d. "pc" choice should be inside the game loop so that it changes if the user does not want to quit
2. Use better spacing/formatting. Click near the brackets and your editor should highlight both the start and end to help you out, so that you can see where it starts and ends --> you basically mis-aligned a bunch of stuff
3.
switch(var)
is for many simple comparisons against
var
. In this case you're checking many conditions, so use
1 2 3 4 5 6 7 8 9 10 11
|
if(...)
{
...
}
else if(...) // A bunch of these
{
...
}
else // In case of errors; default case
{
}
|
4. Add descriptions like a DESC array. Otherwise it'll just say "pc Choice is 1" -- what is 1?
4b. (related) compare things with your const variables, like PAPER, ROCK, etc. Don't continue to compare against 1,2,3 when you can make it clearer for the reader of the code.
Edit: on second thought, noticed you said project. Redacted fixed code for now. Try to improve it yourself and get closer first (at least compiling).