Thread: Console Problems

  1. #1
    Resident Programming Nut
    Join Date
    Oct 2004

    Unhappy Console Problems

    Hey people,

    I'm a newbie at C++ and am taking things nice and slowly for the moment. I've created my first C++ program "Hello World". It compiles correctly but when i run the program all it does is pop up and disappear in less than a second. The code is as follows:
    #include <IOSTREAM>

    int main ()

    std::cout << "Hello World!\n"; // Displays Hello World
    return 0;
    I can't figure out what's going wrong. I'm using Dev C++ to create my programs. Can anyone give me any pointers as to the problem? Could it be to do with the enviroment or compiler options?

  2. #2
    Registered User
    Join Date
    Aug 2004
    San Diego, CA
    The FAQ has a lot of useful answers in it. I suggest you peruse it sometime.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Welcome to the board
    Please use &#91;code]&#91;/code] tags around your future code posts.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Visalia, CA, USA
    I notice the new VC++ 8 compiler actually pauses after a program whether or not you add code to tell it to do so. You could always just switch to this compiler if you are a winbloze user.

  5. #5
    i dont know Vicious's Avatar
    Join Date
    May 2002
    MinGW Studio does the same. And honestly I would suggest it over anything else (free wise).

    Check out the link in my signature.

    Also, the reason it does this is because it is the "debug" build of the application. So the "release" build wont have that.

    And a quick answer to your question.

    #include <iostream>
    int main ()
        std::cout << "Ah";
        // This will wait for you to hit enter
        std::cin.get ();
        return 0;
    Still, go and read the FAQ. Alot of good stuff in there.
    What is C++?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. Told ya so...
    By Cheeze-It in forum A Brief History of
    Replies: 58
    Last Post: 09-12-2007, 08:12 PM
  3. CreateProcess and console handles
    By manannan in forum Windows Programming
    Replies: 1
    Last Post: 11-12-2005, 02:17 AM
  4. Full Screen Console
    By St0rmTroop3er in forum C++ Programming
    Replies: 1
    Last Post: 09-26-2005, 09:59 PM
  5. Console Functions Help
    By Artist_of_dream in forum C++ Programming
    Replies: 9
    Last Post: 12-04-2004, 03:44 AM