Feb 12, 2013 at 12:28pm UTC
im trying to run this simple program, and ran into a classic problem of having my contol terminal shut down right after the program is executed
using namespace std;
int main ()
cout << "Please enter an integer value: ";
cin >> i;
cout << "The value you entered is " << i;
cout << " and its double is " << i*2 << ".\n";
std::cout << "Press ENTER to continue...";
std::cin.ignore( 80, '\n' );
i have no clue what to do to fix this any suggestions?
Feb 12, 2013 at 12:30pm UTC
Are you running this from an IDE or actually navigating to the exe in the command prompt?
If it's from an IDE, see the sticky post at the top of this forum. It offers several ways to keep the window open.
Feb 12, 2013 at 12:59pm UTC
What compiler are you using
Feb 12, 2013 at 1:01pm UTC
If you are using Visual Studio, use the Start without debugging feature, ore just use system("pause")
use system("pause") only for small personal projects, since they are sort of bad to use, if you enter a competition, NEVER use system("pause")
Feb 12, 2013 at 1:21pm UTC
How about setting a breakpoint on the
line, then run to the breakpoint with the debugger. Viola - you get to see your output and the contents of your variables.