After creating a basic game, I thought I would brush on some advanced OOP. (I only used really basic classes in my game). But when I came back to the console, the window disappeared immediately. I tried using cin.get(); and system("pause"); but none of them worked and I cannot see why. I just created the most basic program ever
1 2
int x = 5; cout << x; return 0;
//cin.get(); || system("pause");
Since you're on Visual C++, a bit old and crude way to "stop" the console window from closing is to use a getch();
at the end of your program.
You'll have to include conio.h as a header file.
So the above program that you wrote will become:-
1 2 3 4
int x = 5;
cout << x;
getch(); // #include<conio.h>
return 0;
This will stop the program flow, with the program waiting for you to press a key. The program flow will continue when you press a key.