here is my code:
for some reason when i change,Code:int menu(void) { int answer = 0; do { cout << "----Menu----" << endl << "1 Add two fractions" << endl << "2 Multiply two fractions" << endl << "3 Exit the program" << endl << "Please select an option (1, 2, or 3): "; cin >> answer; } while (answer != 1); return answer; }
i can not seem to get the loop to stop once the correct answer is input.Code:} while (answer != 1); // to this } while (answer != 1 || 2); // or this } while (answer != '1' || '2');
I have looked at both the do, while and || operator and cant seem to find where the problem is because it causes no errors.
Thanks to anyone that can help.



LinkBack URL
About LinkBacks


