setting a range

hello!

i am currently working on an array, and i want a user to only select between 1-50 (when inputting a number). i am so new to this, and the book does not underline how to properly set a range in c++. please help me.

thanks.
-megan
also, if the number is greater than 50, it needs to let the user know they are out of range.

thanks again.
-megan
Last edited on
do this:
1
2
3
4
5
6
int i;
do{
    cin >> i;
    if(i<=50)break;
    else cout << "NUMBER OUT OF RANGE!!!\n";
}while(1);
Last edited on
Topic archived. No new replies allowed.