Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (fellowroot):

How do I set up a flag in C to limit the users input while scanning values from a user. for example say the person must type in 3 numbers. I need a flag so that if the person only wanted to type in 1 number then it would be ok or if the person wanted to type in 5 numbers. my teacher wants this but i can't find this anywhere on the net. Thanks

OpenStudy (rsmith6559):

If you know how many they're going to enter, you could use a for() loop for entering the numbers. If you don't, you could use a while() loop and a sentinel value ( say "Enter 0 to quit" ).

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!