Thread: how to tell program to stop!

  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,059
    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,195
    put this in main()
    Code:
    return 0;

  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,669
    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