Rock-Paper-Scissors

Can somebody please tell me where the problem is in this program?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <iostream>

using namespace std;

enum playerChoice { Rock, Paper, Scissors };

int main()
{ 

	do
	{
		int playerChoice;
		cout << " To play, please select r for Rock, p for Paper, or s for Scissors." << endl;
		cout << " To quit, select any other character. " << endl;
		cin >> playerChoice;


		    if (playerChoice = 0)
			{
				cout << "Player: Rock " << endl;
			}

	   else if (playerChoice = 1)
			{
				cout << "Player: Paper " << endl;
			}

	   else if (playerChoice = 2)
			{
				cout << "Player: Scissors " << endl;
			}



             int compChoice;
			 compChoice = rand() % 3;

			if (compChoice = 0)
			{
				cout << "Computer: Rock " << endl;
			}

	   else if (compChoice = 1)
			{
				cout << "Computer: Paper " << endl;
			}

	   else if (compChoice = 2)
			{
				cout << "Computer: Scissors " << endl;
			}


			if ((playerChoice == 0) && (compChoice = 0)||
				(playerChoice == 1) && (compChoice = 1)||
				(playerChoice == 2) && (compChoice = 2))
				}
				cout << "It's a tie! " << endl;
				{

	   else if ((playerChoice == 0) && (compChoice = 2)||
				(playerChoice == 1) && (compChoice = 0)||
				(playerChoice == 2) && (compChoice = 1))
				}
				 cout << "Congratulations! You win! " << endl;
				{

	   else if ((playerChoice == 0) && (compChoice = 1)||
				(playerChoice == 1) && (compChoice = 2)||
				(playerChoice == 2) && (compChoice = 0))
			    }
				 cout << "Oops! You lose! " << endl;
				{
	}while ((playerChoice > 0) && (playerChoice < 2));
	cin.ignore();
	cin.get();
}
All your comparisons to compChoice use the assignment operator instead of the equality operator.

Also, don't you that if a==k && b==k, then a==b?
Topic archived. No new replies allowed.