TRouble with cmd

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

#include <iostream>
using namespace std;

int main ()
int i;
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' );

return 0;

i have no clue what to do to fix this any suggestions?
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.
What compiler are you using
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")
How about setting a breakpoint on the return 0; line, then run to the breakpoint with the debugger. Viola - you get to see your output and the contents of your variables.
Topic archived. No new replies allowed.