Write the function definition for a function that requests the user to enter an integer between 19 and 47 (both exclusive). Repeat (loop) within the function until a valid number is entered. Return the user’s number using a reference parameter.
#include<iostream>
using namespace std;
void getUserNum(int &num)
{
do{
cout<<"Enter number in range 19 to 47(Exclusive): ";
cin>>num;
}while(num<=19||num>=47);
}
int main()
{
int n;
getUserNum(n);
cout<<"\nuser Number is :"<<n;
}
Get Answers For Free
Most questions answered within 1 hours.