how to tell program to stop!

This is a discussion on how to tell program to stop! within the C Programming forums, part of the General Programming Boards category; Hi! im writing a program that prints an entered date in words i just want to know if there is ...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    1

    how to tell program to stop!

    Hi!

    im writing a program that prints an entered date in words
    i just want to know if there is anyway i can tell my program to stop at a specific point
    example, if this thing is true, then dont go on to do the rest of the program for that condition
    thanku

  2. #2
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,047
    Provide more details, perhaps the code snippet that needs to be modified.

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    put this in main()
    Code:
    return 0;
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,650
    exit(1);

  5. #5
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by rags_to_riches View Post
    exit(1);
    exit(1) indicates improper termination,so exit(0) should be used.

  6. #6
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by BEN10 View Post
    exit(1) indicates improper termination,so exit(0) should be used.
    Unless you're exiting because of an error, like file not found... then exit(1) or some other number would be appropriate.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Early program stop problem
    By bmb_ksu in forum C Programming
    Replies: 9
    Last Post: 02-19-2006, 08:24 AM
  2. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  3. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  4. continuing program until ready to stop
    By jlmac2001 in forum C++ Programming
    Replies: 2
    Last Post: 01-19-2003, 06:19 PM

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