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.