A command line program always closes the window after it has finished executing. I know you can use cin.get(); to wait for the user to enter input. Is there a way where the user could press any key (instead of entering something then pressing enter) to close the program? I don’t want to use system("PAUSE") as it’s Windows specific and slow.
I want it to pause so that the user can see it completed successfully and other details. It would probably not be run from an already open command line and the executable would be double clicked to run.
Yes. “system(“PAUSE”) is one way. A simple “getchar()” or “cin” should be absolutely equivalent 🙂