My question is super simple, but I’m transitioning from C# to C++, and I was wondering what command holds the console window open in C++?
I know in C#, the most basic way is:
Console.ReadLine();
Or if you want to let the user press any key, its:
Console.ReadKey(true);
How do you do this in C++? The only reason I ask this simple of a question here, is that I haven’t been able to find a good and clear answer out there on the internet.
How about
std::cin.get();?Also, if you’re using Visual Studio, you can run without debugging (CTRL-F5 by default) and it won’t close the console at the end. If you run it with debugging, you could always put a breakpoint at the closing brace of
main().