How do I make a C++ console program exit?

前端 未结 13 2418
执笔经年
执笔经年 2020-12-03 16:43

Is there a line of code that will terminate the program?

Something like python\'s sys.exit()?

相关标签:
13条回答
  • 2020-12-03 17:34
    #include <cstdlib>
    ...
    /*wherever you want it to end, e.g. in an if-statement:*/
    if (T == 0)
    {
    exit(0);
    }
    
    0 讨论(0)
提交回复
热议问题