Ok I am aware of the variable types, int, double, char, bool, etc, and the operators, if / then etc.
Here is the scenario:
Ask a person to enter a number from 1 to 100.
On the condition that a valid range is entered,
output "The number you entered is (insert number here)".
Otherwise output "Invalid entry - try again"
and it would proceed to asking the question again
until a valid entry is entered.
Now I would know how to build this, and to declare an int variable, I know how to use cout and cin,
brackets, int main(), namespace, includes, etc.
and I know how to check variables with if/then.
There are 2 ways to do this
1) If the user does not input the correct range a message informs them that the entry is invalid and that the program is terminated.
2) The user is informed of an invalid range and is is informed to try again, where the same question will be asked ,for as long as the user enters the valid range.
How to do number 2
?
In BASIC
10 PRINT"Enter a number from 1 to 100"
20 INPUT A
30 IF A < 1 OR A > 100 THEN PRINT "Invalid - try again":GOTO 10
40 PRINT"The number you entered is "A
50 END
In ASM you have JNE / JEQ to jump back to the code.
What do you do in C++ ?