Thread: windows that closes

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    2

    Exclamation windows that closes

    hello, i'm in the first tutorial c++ lesson. I probe the code of insert a number program. I'm using DevC++ compiler and it works cool. But after press enter key, for regonize the number it appears ant the window close maybe 1 second later.
    So i introduce the comment "cin.get()" to mantain opened the window, as you say in the web , it doesn't work. The window close again.

    COULD YOU EXPLAIN ME WHY? AND GIVE ME A SOLUTION, PLEASE.

    THANKS!!!!

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    OS Dependant:
    system( "pause" );

    Compiler Dependant:
    #include <conio.h>

    cout << "Press any key to continue" << endl;
    getch();
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    use system("pause");

    were u want it to pause after that you just need to hit a key
    to close the window

    also #include <stdlib.h>

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Anyone using Windows 7?
    By Sharke in forum General Discussions
    Replies: 60
    Last Post: 07-12-2009, 08:05 AM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM