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

前端 未结 10 1735
悲&欢浪女
悲&欢浪女 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 22:39

    I use:

    cin.get()
    

    I heard it was less costly than system("PAUSE") and it works on POSIX systems too. There's a great link that goes into detail about this.

提交回复
热议问题