does this work?
make a text file,
type the word pause in it
rename it name.bat
double click it.
yeah the "press any key came up...." came up after like 10 min. its starting to affect other computers in the class room, so it was probably something IT did.....
What compiler do you use?
If I remember correctly "system" needs the header file "stdlib.h". Luckily this is eventually included through "iostream" an was not a problem in my VS 2015.
Not sure what VS 2017 has made in regards to the C header files, but "stdlib.h" may no longer be included through "iostream" and may not even be available.
Not being familiar with your clas computer or network I find it curious that other computers are being affected.
In the end "system" anything should be avoided in favor of something else. You could try using:
std::cout << "\n Press Enter to continue: ";
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); // <--- Requires header file <limits>.
Hope that helps,
Last edited on
In VS it should suffice to press Alt + F7, open the 'Linker'-Tab,
Select the 'Platform'-Tab: Choose either all Platforms, or Active(Win32), or X64
Select the 'SubSystem'-Tab: Console (/SUBSYSTEM:CONSOLE)
Pay attention that the Solution Platform (The small dropdown window next to Debug dropdown window in the menu-bar) is set accordingly to X86 or X64.
Having your project set-up that way, you will not need the system("Pause"); or cin.get() etc. The console window will remain open until pressing a key.