Visual c++ C++编码障碍
} }Visual c++ C++编码障碍,visual-c++,Visual C++,} } 在go North部分之后,它不允许您在cin中键入其余问题,它只是跳过并发布所有cout信息,有人能帮忙吗?我不知道怎么修,因为你先用了,你的安排很糟糕。第二,你需要提供更多关于你想要实现什么的信息?你在第一个“cin”中输入了什么,使它不停地直行?请注意,您已将int用于变量North和North,因此除数字以外的任何内容都将使程序显示其余的“couts”,并在没有执行错误处理时终止 我认为您面临的问题是,您输入的是字母,而不是整数输入的数字 我可以毫无问题地运行这些代码。截图证明
在go North部分之后,它不允许您在cin中键入其余问题,它只是跳过并发布所有cout信息,有人能帮忙吗?我不知道怎么修,因为你先用了,你的安排很糟糕。第二,你需要提供更多关于你想要实现什么的信息?你在第一个“cin”中输入了什么,使它不停地直行?请注意,您已将int用于变量North和North,因此除数字以外的任何内容都将使程序显示其余的“couts”,并在没有执行错误处理时终止 我认为您面临的问题是,您输入的是字母,而不是整数输入的数字 我可以毫无问题地运行这些代码。截图证明 从屏幕截图中可以看到,输入的值根本没有被检查。我可以为问题输入3,1表示是,2表示否,它仍然继续。包括您的if语句或您用于执行检查的任何方式,然后继续下一步。请确保清楚地说明用户应输入的输入。为不同的标准设置适当的变量类 如果您不知道如何实现或完成此操作,或者需要进一步帮助,请发表评论。我会用代码编辑这篇文章
int North, north;
cout << "You enter the forest, where would you like to go.\n" << endl;
cin >> North;
int Yes;
cout << "You appear in front of a cave, you see a sign saying. Canifis Cave BEWARE!\n" << endl;
cout << "Are you going to enter. (1.Yes/2.No?)\n" << endl;
cin >> Yes;
cout << "You enter the cave.. It is lit by torches only going westward. Are you going to follow the lit path? (Yes/No)\n" << endl;
cin >> Yes;
cout << "You see the the goblins.\n" << endl;
cout << "They are asleep and you see the Sword Of A Thousand Truths against the wall on a makeshift stand.\n" << endl;
int pickOption;
cout << "You can either kill the goblins by throwing a torch off the wall on them and retrieve the sword.\n";
cout << "Or you can just quietly take it and leave\n" << endl;
cout << "1 - Kill goblins with torch then take The Sword Of A Thousand Truths.\n" << endl;
cout << "2 - Take The Sword Of A Thousand Truths quietly and leave.\n" << endl;
cin >> pickOption;
switch (pickOption)
{
case 1:
cout << "The Goblins burned to death, congratulations!. you retrieve The Sword Of A Thousand Truths.\n" << endl;
cout << "You make your way back to Doric and give him the family heirloom he thanks you.\n";
cout << "You then leave and continue on your journey after finishing Doric's Quest.\n";
cout << "CONGRATULATIONS ON COMPLETEING DORIC'S QUEST!!\n" << endl;
break;
case 2:
cout << "You sneak by the goblins, retrieve the family heirloom and make your way out the cave unnoticed.\n" << endl;
cout << "You make your way back to Doric and give him the family heirloom he thanks you.\n";
cout << "You then leave and continue on your journey after finishing Doric's Quest.\n";
cout << "CONGRATULATIONS ON COMPLETEING DORIC'S QUEST!!\n" << endl;
break;
}
return 0;