Question: Heres a function that implements the standard Enter a number within this range loop: int Get_Num(int low, int high){ cout < < Enter a number
- Heres a function that implements the standard Enter a number within this range loop:
int Get_Num(int low, int high){
cout << Enter a number between << low << and << high;
int x;
cin >> x;
while(x < low || x > high){
cout << Illegal value! << endl;
cout << Enter a number between << low << and << high;
cin >> x;
}
// if we get here, we have a legal value
return x;
}
Rewrite this function to be recursive.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
