0

我正在用 C++(命令行工具格式)编写冒险游戏,但我不知道是使用字符还是字符串变量来进行多字输入。我的代码看起来像这样:

if(directionOne=="go to lake"){cout<<"You are at the lake."}

directionOne 是我想知道的变量。当我使用 char 或 string 时,它只是在我完成后关闭程序。

4

1 回答 1

2

将其声明为std::string

std::string directionOne;
于 2013-04-12T21:34:16.200 回答