Noob help - Repeating a simple DOS program without exiting

This is a discussion on Noob help - Repeating a simple DOS program without exiting within the C Programming forums, part of the General Programming Boards category; Hello out there. I am brand new to programming in C, and I'm just jacking around with some basic DOS ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    1

    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)
    Y

    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.

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

  2. #2
    Aia
    Aia is offline
    Beautiful to C Aia's Avatar
    Join Date
    Jun 2007
    Posts
    124
    Code:
    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
    Location
    Canada
    Posts
    8,046
    dwk

    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: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    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, 06:40 AM
  5. DOS program versus DOS console program
    By scromer in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 01-10-2002, 12:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21