Thread: Newbie Question about Bloodshed

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    3

    Newbie Question about Bloodshed

    I have the Bloodshed Dev -C++ compiler. I put in the code for "hello world" and it compiles , but then when the dos screen comes up to show the program it stays for a second then is gone. Why is it doing this? Shouldn't it stay up. I dont even have time to read the "hello world"?

  2. #2

  3. #3
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Welcome to the boards. If you haven't already done so then please take some time to familiarise yourself with the faq:
    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

    Make sure you have a look at the the posting guidelines:
    http://cboard.cprogramming.com/annou...ouncementid=51
    Following the rules will ensure you get a prompt answer to your question.

    Remember, too, that the board has a search facility, a link is at the top of your screen:
    http://cboard.cprogramming.com/search.php
    It will often get you a quicker answer to your questions than waiting for a response to one you have posted.


    If you have any questions about this you may ask or you can contact one of our forum leaders:

    http://cboard.cprogramming.com/showgroups.php
    Woop?

  4. #4
    Registered User
    Join Date
    Apr 2005
    Posts
    3
    thank you 1

  5. #5
    Registered User
    Join Date
    Apr 2005
    Posts
    5
    You can also use a getch(); command at the end of your program which waits for the user to hit any key on the keyboard. This stops your program from running and disappearing before you can see it. It is included in the <conio.h> library.

  6. #6
    Registered User
    Join Date
    Nov 2004
    Posts
    6
    you can also use the command

    system("pause");

    this will freeze the program and start a new line that says something like, "press any key to continue..." and will wait for a keypress.

  7. #7
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Ah nothing better than a non-standard method and a not very smart method.
    Woop?

  8. #8
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688

    Hi heres the answer

    I have the same compioler as you, and here is how to solve the problem.

    just before you type

    return 0;

    on the line above type either of these:

    cin.get();

    or if that doesnt work this one will:

    system("pause");

    the system pause is a dos command and freezes the console window untill you hit retrurn....

    i hope this helps you peter

  9. #9
    Registered User
    Join Date
    Apr 2005
    Posts
    3
    yes! it helped. Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 04:43 AM
  2. Newbie with Very Newbie Question
    By Jedi_Mediator in forum C++ Programming
    Replies: 18
    Last Post: 07-01-2008, 08:00 AM
  3. newbie: array question :(
    By cstudent in forum C Programming
    Replies: 2
    Last Post: 04-09-2008, 06:46 AM
  4. C prog newbie question
    By Draginzuzu in forum C Programming
    Replies: 1
    Last Post: 02-03-2003, 06:45 PM
  5. total newbie question
    By Unregistered in forum C++ Programming
    Replies: 15
    Last Post: 08-16-2002, 09:38 PM