酷代码 AI
菜单
服务商

C++代码:根据输入“apple”或“orange”输出正确答案

#include <iostream> #include <string> int main() { std::string userInput; std::cout << "请输入单词 apple 或 orange:"; std::cin >> userInput; if(userInput == "apple") { std::cout << "正确答案是苹果。" << std::endl; } else if(userInput == "orange") { std::cout << "正确答案是橙子。" << std::endl; } else { std::cout << "输入错误,请输入单词 apple 或 orange。" << std::endl; } return 0; } ######[AI写代码神器 | 309点数解答 | 2024-11-01 06:55:55]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]