I'm doing c++ practice exercises. The one question that I'm on is as follows...
Write a program that continues to ask 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.
★ Modify the program so that after 10 iterations if the user still hasn't entered 5 will tell the user "Wow, you're more patient then I am, you win." and exit.
#include <iostream>
using namespace std;
int main()
{
int userNum;
int numTimes = 0;
do
{
cout << "Please enter a number: ";
cin >> userNum;
numTimes++;
}while ((numTimes != 10) || (userNum != 5));
{
if (numTimes == 10)
{
cout << "Wow, you're more patient than I am, you win.\n";
}
else
{
cout << "Hey! you weren't supposed to enter 5!\n";
}
}
}
I can't seem to get the or condition of the while loop to work.