当我编写每个 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;
}
我用 G++ 编译它,当我运行它时,它运行良好,但当它完成时,它在程序的最后一个词之后显示“注销”字样,如下所示:
Tell me where to start: 10
10
9
8
7
6
5
4
3
2
1
FIRE!logout
[Process completed]
为什么?我该如何删除它?
最佳答案
它不是来自您的程序。这是因为打开终端的唯一目的是运行您的程序,因此当它退出时,终端将关闭。
如果您打开一个 shell 并手动运行您的可执行文件,您只会看到另一个命令提示符,而不是这条消息。
关于c++ - 每个程序上的 "logout"字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20642749/