Thread: Noob help - Repeating a simple DOS program without exiting

  1. #1
    Registered User
    Join Date
    Nov 2007

    Question Noob help - Repeating a simple DOS program without exiting

    Hello out there.

    I am brand new to programming in C, and I'm just jacking around with some basic DOS 'hello world' type programs.

    I'm trying to figure out the commands or lines that I would need to include in order to start a program over from its beginning without exiting the program and rerunning from the command line. Basically, a very simple line at the end of whatever just ran, asking the user "Would you like to run that again, Y or N?" If the answer is "N", just end the program at the DOS prompt. If the answer is "Y", then rerun the program.

    (Example output:
    Hello World!

    Would you like to print that again? (Y/N)

    Hello World!

    I hope that makes sense. I'm sure it is very easy if I just RTFM, but I guess I haven't made it to that page in the manual yet.

    Last edited by paxare; 11-17-2007 at 07:45 AM. Reason: Clarification

  2. #2
    Beautiful to C Aia's Avatar
    Join Date
    Jun 2007
    Loop as long as answer is yes
    	display output statement
    	ask question for yes or no

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Simple Blackjack Program
    By saber1357 in forum C Programming
    Replies: 1
    Last Post: 03-28-2009, 03:19 PM
  3. Mystery bug in simple program? - I am beginner
    By archie123 in forum C++ Programming
    Replies: 7
    Last Post: 04-08-2005, 07:23 AM
  4. Help with small simple program
    By Sonor in forum C Programming
    Replies: 5
    Last Post: 04-02-2005, 07:40 AM
  5. DOS program versus DOS console program
    By scromer in forum A Brief History of
    Replies: 4
    Last Post: 01-10-2002, 01:42 PM