Thread: code help

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    176

    Question code help

    ok here is the code
    #include <iostream.h>

    int main()

    {

    int thisisanumber;

    cout<<"Please enter a number:";

    cin>>thisisanumber;

    cout<<"You entered: "<<thisisanumber;

    return 0;

    }
    and i have dev-c++ version 4.9.8.0
    it compiles fine but when i try and run it it says please enter a number and when you do and hit enter the whole box disappears

  2. #2
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    798
    Yeah the programs that dev-c++ makes will do that. They exit straight away and your program is running too fast for you to see anything.

    The simplest thing for you to do is probably put another,

    Code:
    cin>>thisisanumber;
    immediately before your return statement.

    That way the program will wait for you to enter another number before continuing.

  3. #3
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    or, if dev includes it (sorry I'm not familiar) use Sleep before return statement,

    Code:
    Sleep(1000);
    This is explained in detail in the FAQ on this board

    axon

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM