如何让玩家按任意键继续
How to Let Players Press Any Key to Continue?
我想让玩家按任意键继续游戏,但不知道怎么做。下面是我到目前为止的代码:
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "ttWelcome to my first game, A Hero's Journey!nn";
char response;
cout << "tttPress any key to continue!: nn";
cin >> response;
if (response ==
return 0;
}
我目前正在处理if语句,所以忽略它,除非这是我决定玩家是否按压某事的地方。
不需要if条件,因为cin总是等待输入。如果您要求用户输入一个特定的键,那么您需要一个If条件来检查它。
相关文章:
- 循环后如何继续阅读
- 使用一个考虑到std::map中键值的滚动或换行的键
- 如何在c++中只将键插入到bimap的一侧
- 使用2个键的cpp-stl::优先级队列排序不正确
- 有效地使用std::unordered_map来插入或增加键的值
- 我正在尝试使用 c++ 创建一个货币转换程序,我不知道如何继续
- 如何创建一个 while 循环,继续循环,直到在C++中输入'using streams'键?
- 如何隐藏在c++中运行powershell脚本时按任意键继续
- 如何在给定任意数量的整数的情况下创建一个唯一键?并使用该键存储,然后从地图中查找
- 使用任意键(c ++)停止程序
- 如何继续输入,直到用户按下空格键
- C++代码在 Gedit 中有效,但在 VS 中不起作用(它只是打印"按任意键退出......"。消息)
- 通过按任意键退出"do while"而不按回车键?
- Microsoft Visual Studio 2013 C++--按任意键可在新行上继续
- C++按enter键继续
- 在Linux c++中按任意键继续
- 如何在按任意键时使无限循环停止?
- 按任意键继续播放.在Visual Studio Express c++中
- 如何让玩家按任意键继续
- 为什么getch()需要按下一个键才能继续执行其余的代码?