What is the Best Practice for Combating the Console Closing Issue?

前端 未结 10 1712
悲&欢浪女
悲&欢浪女 2020-11-27 22:21

After compiling console programs the console window closes immediately after running. What is the best practice for keeping it open? I\'ve searched google loads, I\'m used t

10条回答
  •  一向
    一向 (楼主)
    2020-11-27 23:06

    Call this function before you return at the end of main:

    void onEnd()
    {
        printf("Press any key to exit...");
        _getch();
    }
    

提交回复
热议问题