Hello there, I just installed Visual Studio.net 2003 last week. When I try to start my program, the console appear and close as soon as the program ends. What is the setting to keep the console open, so I can see if my program works? Thanks Nicole

Recommended Answers

use cin.get() at the end of ur program

#include<iostream> 
 using namespace std;    
int main()  
{      
    //your code here

    cin.get();      
    return 0;  
}

If this still doesnt work use cin.get() twice

#include<iostream>  
using namespace std;    
int main()  
{      
    //your code here 

   cin.get();      
   cin.get();         
    return 0; …
Jump to Post

All 3 Replies

use cin.get() at the end of ur program

#include<iostream> 
 using namespace std;    
int main()  
{      
    //your code here

    cin.get();      
    return 0;  
}

If this still doesnt work use cin.get() twice

#include<iostream>  
using namespace std;    
int main()  
{      
    //your code here 

   cin.get();      
   cin.get();         
    return 0;  
}

There are otherways to halt the the console screen but this is the easiest one (except for getch() which might not be portable).

i use:

system("PAUSE");

instead of cin.get();

commented: Don't bump 4-year-old threads to offer poor advice. -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.