小编Use*_*000的帖子

"如果"语句没有正确执行c ++

我对ifc ++中的语句有一个小问题.以下是代码片段:

string answer;
cin >> answer;

if (answer == "stay in bed")
{
   cout << "You lay there, motionless. Silent.";
}
else if (answer == "go to the bathroom")
{
   cout << "You get up and walk across the hall to the bathroom.";
}
else if (answer == "go downstairs")
{
   cout << "You get up and walk down the stairs to the kitchen.";
}
else
{
   cout << "That is not a valid answer...";
}
Run Code Online (Sandbox Code Playgroud)

当我输入任何值时,我从 …

c++ if-statement codeblocks

1
推荐指数
1
解决办法
155
查看次数

标签 统计

c++ ×1

codeblocks ×1

if-statement ×1