windows that closes

This is a discussion on windows that closes within the C++ Programming forums, part of the General Programming Boards category; hello, i'm in the first tutorial c++ lesson. I probe the code of insert a number program. I'm using DevC++ ...

  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, 09:05 AM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 06:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 03:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 01:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 06:31 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21