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

  1. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!