Answer confirmation

Hi I'm having trouble with the following code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
cout << "Queston 1" << endl;
		cout << "The Chinese admiral who led state-sponsored naval expeditions during the Ming" << endl;
		cout << "Dynasty was:" << endl;
		cout << "1. Hongwu" << endl;
		cout << "2. Zheng He" << endl;
		cout << "3. Wang Mang" << endl;
		cout << "4. Kangxi" << endl;
		cout << "5. Yang Guifei" << endl;
		cin >> answer;

		if (answer=1)
			cout << "Wrong! The answer was: 2. Zheng He" << endl;
		if (answer=2)
			cout << "Correct!" << endl;
		if (answer=3)
			cout << "Wrong! The answer was: 2. Zheng He" << endl;
		if (answer=4)
			cout << "Wrong! The answer was: 2. Zheng He" << endl;
		if (answer=5)
			cout << "Wrong! The answer was: 2. Zheng He" << endl;

Whenever I put in an answer (right or wrong, doesn't matter) I just get a list of everything that is after the if statements. Can someone tell me what I'm doing wrong?
[NOTES]
I already tried using:
1
2
3
if (answer=2)
    cout << "Correct!" << endl;
else cout << "Wrong! The answer was: 2. Zheng He" << endl;

But it would always just say "Correct!" No matter what the answer was.
answer=1 : assigns 1 to answer, then returns 1, which gets converted to a boolean true.

answer==1 : compares answer to 1, returns true if equal, false if not.

Oh! Thanks!
Topic archived. No new replies allowed.