简体   繁体   English

我如何不在代码块中自动关闭程序

[英]How can i dont close program automatically in codeblocks

codeblocks close console window automatically.代码块自动关闭控制台 window。 i may use我可以用

system("pause")

But it is not comfortable, i would like make it automatically但它不舒服,我想自动制作

You can find the solution to your problem in this setting:您可以在此设置中找到问题的解决方案:

Project -> Properties -> Build Targets -> [Debug/Release/Any other Build Target you definend] -> Pause when execution ends项目 -> 属性 -> 构建目标 -> [调试/发布/您定义的任何其他构建目标] -> 执行结束时暂停

Little hard to understand your issue, try adding it near the bottom with semi colon:有点难以理解您的问题,请尝试在底部附近添加分号:

system("pause");

like so像这样

#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cout << "enter first name";
    cin >> s;
    cout << "Hello, " << s << '\n';
    system("pause"); // <------------
    return 0; // optional
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM