C++ Loop in menu
c++, loops
Solution
You want to use the And (`&&`) operator in your test, not the Or (`||`) operator. Otherwise, one of `selection != 'Q'` and `selection != 'q'` will always be true, and your loop will never exit.
Problem
In my code there is a problem where even when I enter 'Q' or 'q' the program keeps looping the menu. What's wrong here? Here is the code: ``` { char selection; do { cout << "Add a county election file A" << endl; cout << "Show election totals on screen P" << endl; cout << "Search for county results S" << endl; cout << "Exit the program Q" << endl; cout << "Please enter your choice: "; cin >> selection; } while ((selection != 'Q' || selection != 'q')); return 0; } ```