Preventing console window from closing on Visual Studio C/C++ Console application

前端 未结 21 1694
灰色年华
灰色年华 2020-11-21 23:42

This is a probably an embarasing question as no doubt the answer is blindingly obvious.

I\'ve used Visual Studio for years, but this is the first time I\'ve done any

21条回答
  •  逝去的感伤
    2020-11-22 00:03

    You could run your executable from a command prompt. This way you could see all the output. Or, you could do something like this:

    int a = 0;
    scanf("%d",&a);
    
    return YOUR_MAIN_CODE;
    

    and this way the window would not close until you enter data for the a variable.

提交回复
热议问题