如何撤消系统(“暂停”) 我正在制作一个C++程序,并做了一些实验。我包括了系统('pause')功能。现在显然我无法关闭程序。如何撤消它并退出程序?我真的需要重启我的电脑吗
基本上我是在恶作剧。这是src代码如何撤消系统(“暂停”) 我正在制作一个C++程序,并做了一些实验。我包括了系统('pause')功能。现在显然我无法关闭程序。如何撤消它并退出程序?我真的需要重启我的电脑吗,c++,C++,基本上我是在恶作剧。这是src代码 #include <iostream> #include <cstdlib> using namespace std; int main() { char answer; cout << "Can gh0st be VIP?:(y=Yes/n=No)"; cout << endl; cin >> answer; if (answer == 'y')
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
char answer;
cout << "Can gh0st be VIP?:(y=Yes/n=No)";
cout << endl;
cin >> answer;
if (answer == 'y')
{
cout << "thanx ande =)";
cout << endl;
}
else if (answer == 'n')
{
cout << "time to pay ande ahaha!\a\a\a\a\a\a\a...*with at least 200 more of these*";
cout << endl;
}
else
cout << "just put the letter y or n lol try it again";
cout << endl;
system("pause");
return 0;
}
#包括
#包括
使用名称空间std;
int main()
{
答案;
答不上来;
如果(答案='y')
{
CUT< P>按下“输入”… < P> <代码>暂停> />代码不是C或C++的一部分,这是Windows命令提示符中的命令,它使用<代码> Stor()< /Calp>SysCal.
调用system()
后,线程将挂起,直到使用system()
调用的任何程序或命令结束并返回退出代码
pause
是一个shell命令,它将等待用户按下任何键。按下任何键都将中断pause
,程序将继续
只需确保您按下的键不是重置按钮。我建议您不要执行系统(“暂停”)
cin.ignore();
cin.get();
这是一种较长的停顿形式,我发现它非常容易使用。而且您只需点击“帮助”菜单旁边的小红方块。重新启动是不够的。您需要买一个新的。(提示:不需要,不需要新的,不需要重新启动)你试过按回车键吗?或者你重定向了输入。哦,毕竟是一些代码…你意识到没有系统(“暂停”)吗
在你的代码中?@Amit啊,谢谢。你让我开心了。:@tacocate:我得到了sh:1:暂停:找不到
,程序存在。我喜欢这个答案的简单性。输入没有帮助。控制台窗口的输出是什么?你甚至在Windows环境中工作吗?按下重置按钮有什么问题吗?没有,它只是不会重新启动将rn控件添加到您的程序中。