cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
setting a range
setting a range
Feb 18, 2011 at 7:19pm UTC
meganbutterfly
(4)
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
Feb 18, 2011 at 7:20pm UTC
meganbutterfly
(4)
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
Feb 18, 2011 at 7:21pm UTC
Feb 18, 2011 at 8:16pm UTC
rocketboy9000
(562)
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
Feb 18, 2011 at 8:17pm UTC
Topic archived. No new replies allowed.