每个节目都有"注销"字样

Paz*_*r80 0 c++ compiler-construction logout

当我编写每个C++程序时,例如:

#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n;
    cout << "Tell me where to start: ";
    cin >> n;
    while (n>0) {
        cout << n << "\n";
        n = n-1;
    }
    cout << "FIRE!";
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我用G ++编译它,当我运行它时,它运行良好,但是当它完成时它会在程序的最后一个单词之后显示"logout"字样,如下所示:

Tell me where to start: 10
10
9
8
7
6
5
4
3
2
1
FIRE!logout

[Process completed]
Run Code Online (Sandbox Code Playgroud)

为什么?我该如何删除它?

zne*_*eak 7

它不是来自你的程序.这是因为打开终端的唯一目的是运行程序,因此当终端退出时终端关闭.

如果你打开一个shell并手动运行你的可执行文件,而不是这个消息,你只需要另一个命令提示符.