C++ while problem
The program was meant to continue to asks the user to enter any number other than 5 until the user enters the number 5, then tell the user "Hey! you weren't supposed to enter 5!" and exit the program. However, if the user input isn't five, the while loop continues, not asking for input, but printing the phrase "Enter another number" over and over again. How do I get the program to work as intended? this is my program: #include <iostream> using namespace std; int input; int main() { cout << "Enter any number other than five!" << endl; cin >> input; while(input != 5) { cout << "Enter another number" << endl; cin >> input; } if (input == 5) { cout << "Hey, you weren't supposed to do that!" << endl; } return 0; }