这是我的 C++ 代码:
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
cout << "Hello, world!" << endl;
system("pause");
system("cls");
return 0;
}
我在 cygwin 中编译它,出现以下错误: sh: line 1:pause: command not find sh:第 1 行:cls:未找到命令。 我已经安装了 ncurses 但它仍然无法工作,有人可以帮忙吗?
如果你确实想运行这个程序,你可以使用system(“cmd.exe /cpause”)或system(“cmd.exe /c cls”)。然而,正如其他人已经指出的那样,它可能不完整或构成安全风险。