50 Zeroes Loop

So this is the assignment:

This program asks the user to type in a number from 1 to 50. If the user does not type a valid number, it will continue asking the user to enter numbers until they enter a valid number. The program will then print zeros the number of times that entered. It will then ask the user if they want to do it again.

I AM NOT ASKING FOR SOMEONE TO DO IT FOR ME, I just need help. (have to learn for the test). I truly hate programming and will never take another class it in. The goal is to just finish this class and move on to mathematics or mechanical engineering. I now hate myself for picking computer engineering.

We have to use all three loops on this assignment, and that doesn't make any sense to me. It seems like it should just be one loop with error coding in place. Also, I have no idea the command execution to print out the user input number of zeroes.

Any help is greatly appreciated.

 
  cout<< "I am bad and switching my major after this class" endl;
Three loops, indeed.

Do you know how to print out one 0?
It takes a loop to repeat that N times. What do you remember about loops?

You have to get valid input. If that does not succeed at first try, then you have to keep asking again. Again, a loop can repeat the "ask and test", until you do have a valid N.


Everything that we have done above (get a valid N, print 0 for N times) is just one time. The program has to repeat all of that as often as the user wants. All of that must thus be inside a loop. The third loop.
Topic archived. No new replies allowed.