Im having trouble getting this to work. Im not sure if Im using the OR operator right... since it will only output the "Wrong!" no matter what.
Just assume the rest of the code is there.
What am I doing wrong?Code:cout << endl << "Now, what number am I thinking of from 1 to 10?" << endl; cin >> answer; if (answer == (6 || 9)) { cout << "Right!" << endl; } else if (answer == (5 || 7 || 8 || 10)) { cout << "Close! But you just missed it!" << endl; } else { cout << "Wrong" << endl; }
Im a beginner just playing around with C++
Thank you for any help.



LinkBack URL
About LinkBacks


