I've compiles and ran this simple program using code:blocks and it works fine. But if I run the dot exe version the console window closes immediately and I want to fix it to stay open so a user can read it. Note I've used cin.ignore (); and cin.get (); but these function don't help. What am I doing wrong?
Code:
#include <iostream>
using namespace std;
int main ()
{
int thisisanumber;
cout << "Please enter a number: ";
cin >> thisisanumber;
cin.ignore ();
cin.get ();
cout << "You entered: " << thisisanumber << "\n";
}