Loop Structure

Hi, I am quite new to C++ programming and this is my first thread, for an assignment I must code a program to count off 10 9 8 7.....1 blast off, using a looping a structure, I was wondering if it was possible to code this without using line breaks. As of now my program runs in 1 line, 10.......1blast off is in one single line and I need it to count off 10-1 and blast off on all separate lines. Also what loop structure would you recommend to use, help is much appreciated, I do not want someone to code this for me because I wont learn a thing that way. Thanks in advanced.
Can you post your code so we can see it and maybe give you a better idea of where to go?

Just use the [code] tags around it.
Last edited on
I think a for loop would be the easiest to do this, in my opinion.

Also, try the Sleep function. Sleep(n);
It makes the program sleep for n milliseconds.
I believe you have to include the window.h library as well.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686298(v=vs.85).aspx

Sorry, I may have misunderstood your question. If you need the countdown on different lines, just endl after every output.
Last edited on
I will upload code shortly, as of now my program looks like this

10...9...8...7...6...5...4...3...2...1...0...BLAST OFF!!

I need each number to be on its own line, I am afraid if i just endl; after each statement I will not be doing the correct assignment (I already did it this way and thought that it was too easy)

"Use a looping structure(for,dowhile,while)" are my requirements for the program. I assume I am supposed to use all 3 intertwined in the program.

I will upload code momentarily to show you how it currently looks.

Thanks again!
Sounds like you should just use endl and that will work fine. You can use it in a looping structure and that sounds like what your assignment is.
Is your program actually suppose to count down? Or just display that 10...9.....1 string. It seems a little silly if it just displays that string then ends.
Last edited on
Sorry had a problem with a storm last night lost power, no I am not just running that string, I have it properly coded now and it shows 10-0 on separate lines as i took the advice from this thread and used breaks. Thanks to all who helped
Topic archived. No new replies allowed.