我对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)
当我输入任何值时,我从 …