Thread: Window keeps closing....

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

    Question Window keeps closing....

    Hey everyone,

    I'm a newie to C++. I'm learning on my own and am finding it interesting. However, I'm having a problem. Everytime I execute my properly compiled code the window will not stay open until the execution is complete. It just flashes open and closes.

    I'm using DevC++. Can someone tell me what I need to do to stop this from happening?

    Much thanks,

    Drojen

  2. #2
    Weak. dra's Avatar
    Join Date
    Apr 2005
    Posts
    166
    you can either add a cin.get() at the end your main function, or run your executable in Command Prompt

  3. #3
    Registered Usurer
    Join Date
    Apr 2005
    Location
    upstate NY
    Posts
    79
    Hi drojen,

    I'm in the same boat as you but I've been at it for a few months.

    You may need
    Code:
    cin.ignore();
    cin.get();
    or
    Code:
    system("PAUSE");
    I don't know about you but I don't know what this means:

    run your executable in Command Prompt
    Also, check the FAQ, this is covered there.

    Good luck

    -JM

  4. #4
    Banned
    Join Date
    Jun 2005
    Posts
    594
    it means you type cmd in the run menu, bring up a command
    prompt, then you can either type out the path, or drag
    and drop your program into the command window and
    hit enter to run your program within the command prompt.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

  6. #6
    Registered User
    Join Date
    Aug 2005
    Posts
    3
    Thanks guys for all your help. I'll let you know what happens.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM