c++ - 如何解决:else 语句未被调用 c++
问题描述
所以我有这个项目,我正在使用嵌套的 if 语句,但我的 else 语句没有被调用,我尝试在括号周围移动,但没有运气......
cout << "WELCOME TO OLIVER'S CHOOSE YOUR OWN ADEVTURE\n\n";
cout << "Would you like to go down the hard path or the easypath? \n\n>";
cin >> R1;
if (R1 == "hard" || "Hard") {
cout << "you chose the hard path... ";
cout << "\nYou stumbled upona pool and a cow where do you want to go? (pool / cow) d\n\n>";
cin >> R2;
if (R2 == "pool" || "Pool") {
cout << "\n\ncongrats ur swimming do you want to fight the water snake or swim away (fight / swim)";
cout << "\n\n>";
cin >> R4;
if (R4 == "fight" || "Fight") {
cout << "\n\nNice you won... ";
}
else {
cout << "you swam away but you sadly drowned and i'm now upset i wanted you to win... ;(";
}
}
else {
cout << "\n\nYou fought the cow... YOU WON do you want to eat it's meat? (yes or no) \n\n>";
cin >> R5;
if (R5 == "Yes" || "yes") {
cout << "\n\nyou didn't cook it you die now ggs";
}
else {
cout << "\n\nyou starved you die.I had my money on u y u di ?";
}
}
}
else {
cout << "you chose the easy path";
输入 Easy / Easy 输出“你选择了硬路……”
解决方案
推荐阅读
- javascript - 使用 AJAX 调用获取表单时使用 AntiForgeryToken?
- java - 方法退出时新的 ArrayList 对象消失
- git - 当我的分支和主节点没有相关历史记录时,如何进行拉取请求?
- sql - SQL中的CASE语句不起作用
- javascript - 如何将 Angular 属性添加到 HTML 元素
- python - 如何把石头剪刀布打圈
- javascript - getDerivedStateFromProps 中有很多逻辑,瘦与胖 gDSFP
- reactjs - 无法从特定 URL 访问本地声音
- java - 我无法从活动中调用片段方法
- javascript - 使用 Gulp 基于 Handlebars 模板编译 partials 和 markdown