所以我正在做一个文字冒险游戏,我只是编程指导。我有一个带有南北等的脚本,然后是一条if语句,该语句表明如果用户输入的不是方向,它会说这不是方向,并循环到顶部,但不起作用。即使我输入正确的输入,也将始终打印那不是方向。有人可以帮忙吗?
#include <iomanip>
#include <string>
#include <iostream>
using namespace std;
int main()
{
string input;
while (input != "north", "n", "south", "s", "east", "e") {
cout << "Enter a direction" << endl;
getline(cin, input);
if (input == "north" || input == "n") {
cout << "north" << endl;
}
if (input == "west" || input == "w") {
cout << "west" << endl;
}
if (input == "east" || input == "e") {
cout << "east" << endl;
}
if …Run Code Online (Sandbox Code Playgroud)