Here I set up a while loop where I input a selection number 1 or 2. If I choose 1 or 2 it couts the 1 or 2 whatever I choose; if I choose a number below 1 or above 2 it goes to the else statement which asks the user to input again. But if the user inputs the problem is that it won't loop back to the beginning if they choose the right number 1 or 2; it will just end the loop there and not go to the correct if clause. Why is this? I feel as though I attacked it right.
int menus (int selection)
{
while ( selection > 2 || selection < 1)
{
if (selection == 1)
{
cout << " 1 " << endl;
}
if (selection == 2)
{
cout << " 2 " << endl;
}
else
cout << "You didnt choose 2 or 3. Choose again";
cin >> selection;
}
return 0;
}