I'm just getting started with programming and this is my first post on this site, hopefully the start of a long and productive journey!
I'm studying C++ from the Deitel's book and one of the exercises of the control flow 1 (chapter 4 - if, if...else, while) is asking me, among other things, to input a number and check that it's no smaller than 1 and no greater than 20 (in this case an error message has to be displayed to the user until a valid number is entered). In order to make it work I had to use the || operator as follows:
while (number < 1 || number > 20)
{
cout << "Wrong number, insert a valid number";
cin >> number;
}
Problem is, the book has yet to introduce boolean operators (||, && ...)!
So my question is, is it possible to operate such a control on a value without using the "or" operator and only using the if, if...else and while, nested if necessary? Thank you in advance.