Question: Write a program valid.cpp, which asks the user to input an integer in the range 0 < n < 100 . If the number is
Write a program valid.cpp, which asks the user to input an integer in the range 0 < n < 100. If the number is out of range, the program should keep asking to re-enter until a valid number is input.
After a valid value is obtained, print this number n squared.
Example
$ ./valid Please enter an integer: -10 Please re-enter: 1200 Please re-enter: 100 Please re-enter: 7 Number squared is 49
Hint: You can use a while or do ... while loop.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
