My file start in Visual studio, but just goes away immediately as exe file -


i started programming c++ visual studio express 2015, have compiled .exe file, when start admin , enter input , hit "enter", closes down immediately. know file works have tested in vs1.

appreciate guidelines on how make exe file appear on screen more 0000001 milli seconds.

screen shot of vs.

the problem windows closes window when program done default behavior.

from your header file can use keep_window_open(); last statement.

it contains following:

inline void keep_window_open() {     cin.clear();     cout << "please enter character exit\n";     char ch;     cin >> ch;     return; } 

another option, if want keep program unchanged create shortcut , modify command windows use execute follows:

  1. create shortcut ms-dos program or command.
  2. once shortcut has been created, right-click shortcut , click properties.
  3. in properties window, change target location contain cmd.exe command /k switch shown in example below.

change

c:\my programs\test.exe 

to:

c:\windows\system32\cmd.exe /k "c:\my programs\test.exe" 

Comments