My while loop is supposed to accept inputs of 1-4 and invalidate anything in between but it just says invalid input no matter what
std::cout<< "Select an item (1-4):"<<std::endl;
std::cin >>itemselected;
while (itemselected < 1 or itemselected > 4) {
std::cout << "Invalid input. Please enter a number between 1 and 4:"<< std::endl;
std::cin >>itemselected;
I expected it to accept the input and move me forward
New contributor
Kellan Helt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
6