Need help on Clue game

Hello! I need help fixing this clue game.
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include<iostream>
#include<string>

using namespace std;

int rightguy(char ans);
int rightweap(char ans);
int rightplace(char ans);

int main()

{

	char ans1, ans2, ans3;
	int cor = 0;

	do {

		cout << "Who killed Pikachu? \n  \n1. Noah,\n 2. Kyle,\n 3. Connor \n";

		cin >> ans1;

		if (rightguy(ans1))
			cor++;

		cout << "\n What Weapon Was Used? \n \n 1. Bowling Ball \n 2. Pizza Cutter \n 3. Screwdriver \n";

		cin >> ans2;

		if (rightweap(ans2))
			cor++;

		cout << "\n Where was Pikachu Killed? \n \n 1. Lounge \n 2. Humanities Building \n 3. Parking Lot \n";

		cin >> ans3;

		if (rightplace(ans3))
			cor++;

		if (cor == 0)
			cout << "You are completely wrong! Try again. Solve the case of the murdered Pikachu!\n";

		else if (cor == 1)
			cout << "You got 1 right. Try again. Solve the case of the murdered Pikachu!\n";
		

		else if (cor == 2)
			cout << "You got 2 right. You're almost there! You've almost solved the case of the murdered Pikachu!\n";


		else if (cor == 3)
			cout << "You've done it! You've solved the case! It was Noah, with the bowling ball, in the Humanities Building!\n Great Job!";

		else if (cor != 3)
			cor == 0;


	}
	while (cor != 3);

	
	

	
		


	

	system("pause");

	

	}



	







int rightguy(char ans)

{

	char answer = { '1' };
	if (ans == answer)
		return(1);
	else
		return(0);

}

int rightweap(char ans)

{

	char answer = { '1' };
	if (ans == answer)
		return(1);
	else
		return(0);

}

int rightplace(char ans)

{

	char answer = { '2' };
	if (ans == answer)
		return(1);
	else
		return(0);

}


Every time I put down a corr, it keeps piling up and doesn't go back to 0 like I want it to if they don't get all the right answers.

Please help me fix this!

Help the players find out who killed Pikachu!
Last edited on
line 55:
 
cor == 0;

This statement has no effect. Did you mean:
 
cor = 0;


PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.

that's not the problem. If not all of the answers are right, it needs to delete the corrs that pile up from the correct answers made. When trying again after getting one right, that one corr stays, and when you get another try that resulted in 1 correct answer, it says there are two correct answers because there are 2 corrs that piled up.

Do you understand?
Line 15: Move this line inside your loop (line 18).

You don't clear corr on subsequent passes through the loop.

Topic archived. No new replies allowed.