Help with a simple guessing game.

Hello, I am a first year computer science student. I have created a simple guessing game between player and computer. I used a count controlled loop for a best of 7 contest between the computer and player. My problem is, when the player has 2 or more "Wrong" guesses I would like to give them a hint whether the number is odd or even. I thought I had it figured out using an "if else" statement, however the program only even uses the first conditions "cout" statement. (see code below) If someone could help me figure out what I'm doing wrong, or a better way to accomplish the task it would be appreciated. Thanks in advance.

Evan.

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
  #include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>

using namespace std;



int main()

{

	srand (time(0));
	
	int Guess;
	int Attempts;
	
	int Wrong = 0;
	int Right = 0;
	
	

	cout << "Welcome to Guess my number!" << endl;
	
	
	for (Attempts = 0; Attempts < 7; Attempts++) 
		
		while (Right < 4 && Wrong < 4)
		{
		
		int Number = rand()%4 + 1;
		cout << " I am thinking of a number from 1 to 4 can you guess what number it is?" << endl;
	
			if ( Wrong >= 2)
				{
					if ( Number = 1,3 )
						cout << "Here is a hint, my number is odd." << endl;
					else if ( Number = 2,4 )
						cout << "Here is a hint, my number is even." << endl;
				}
			
		
		cin >> Guess;



			if (Guess == Number)
				{
					cout << "Congratulations you guessed my number!" << endl;
					Right++;
				}		
			
			else
				{
					cout << "I am sorry, that is incorrect." << endl;
					Wrong++;
				}
				
		}
	
	
		cout << "You guessed " << Wrong << " wrong and " << Right << " right" << endl;
		 


system ("pause");
return 0;

}
Topic archived. No new replies allowed.