Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Console is being automatticly closed after running

SchwarzeneggerSchwarzenegger Member Posts: 10
Dear programmers!

My problam is this: I am working with visual studio 2005, on c++ enviorement. When I try to compile a project (even the simplest one like: "cout << "hello" << endl;"), The DOS window is being opend and closed in less then a second!! This never happend to me when I was working on 2003, although i've heard several of my friends who've expirienced the same problem on 2003.
Now, I would expect it to remain open with the massage " Hello. Press any key to continue", but alas, it just doesnt.
It has come to my attention that there is a setting need to be alterd in order to solve this small dilema... Does anyone know how???

Sincerly yours,

Rotem Orbach.

Comments

  • tsagldtsagld Member Posts: 621
    : Dear programmers!
    :
    : My problam is this: I am working with visual studio 2005, on c++ enviorement. When I try to compile a project (even the simplest one like: "cout << "hello" << endl;"), The DOS window is being opend and closed in less then a second!! This never happend to me when I was working on 2003, although i've heard several of my friends who've expirienced the same problem on 2003.
    : Now, I would expect it to remain open with the massage " Hello. Press any key to continue", but alas, it just doesnt.
    : It has come to my attention that there is a setting need to be alterd in order to solve this small dilema... Does anyone know how???
    :
    : Sincerly yours,
    :
    : Rotem Orbach.

    End your code with "Console.ReadLine();". That causes your code to wait for input.


    Greets,
    Eric Goldstein
    http://www.gvh-maatwerk.nl


  • DonotaloDonotalo Member Posts: 715
    : Dear programmers!
    :
    : My problam is this: I am working with visual studio 2005, on c++ enviorement. When I try to compile a project (even the simplest one like: "cout << "hello" << endl;"), The DOS window is being opend and closed in less then a second!! This never happend to me when I was working on 2003, although i've heard several of my friends who've expirienced the same problem on 2003.
    : Now, I would expect it to remain open with the massage " Hello. Press any key to continue", but alas, it just doesnt.
    : It has come to my attention that there is a setting need to be alterd in order to solve this small dilema... Does anyone know how???
    :
    : Sincerly yours,
    :
    : Rotem Orbach.
    :
    [purple]
    i dont know about the settings, but u can use the statement [blue]system("PAUSE");[/blue] just before main() returns;
    [/purple]
    [hr][purple]~Donotalo()[/purple]

  • sobanksobank Member Posts: 25
    my solution is i think the oldest one on the block. :)

    void main(){
    cout<<"Hello"<<endl;

    getchar();//this line holds the program until u hit any key.

    }

  • HK_MP5KPDWHK_MP5KPDW Member Posts: 770 ✭✭✭
    : Dear programmers!
    :
    : My problam is this: I am working with visual studio 2005, on c++ enviorement. When I try to compile a project (even the simplest one like: "cout << "hello" << endl;"), The DOS window is being opend and closed in less then a second!! This never happend to me when I was working on 2003, although i've heard several of my friends who've expirienced the same problem on 2003.
    : Now, I would expect it to remain open with the massage " Hello. Press any key to continue", but alas, it just doesnt.
    : It has come to my attention that there is a setting need to be alterd in order to solve this small dilema... Does anyone know how???
    :
    : Sincerly yours,
    :
    : Rotem Orbach.
    :

    [blue]You can add a [italic]cin.get()[/italic] statement or two to the end of your program.[/blue]

Sign In or Register to comment.