选择题 共15道
判断题 共5道
阅读以下代码,程序运行后会输出什么?
#include <iostream> using namespace std; int main() { string craft = "苗绣"; cout << "我们传承的技艺是:" << craft << endl; return 0; }
阅读以下程序,如果用户输入数字 3,输出结果是什么?
#include <iostream> using namespace std; int main() { int choice; cout << "请选择纹样:1.云纹 2.水纹 3.回纹" << endl; cin >> choice; if (choice == 1) { cout << "您选择了云纹" << endl; } else if (choice == 2) { cout << "您选择了水纹" << endl; } else { cout << "您选择了回纹" << endl; } return 0; }
以下代码横线处填入哪个选项,能正确输出数组内容?
#include <iostream> using namespace std; int main() { string herbs[3] = {"三七", "天麻", "石斛"}; cout << "药材清单:"; for(int i = 0; i < 3; i++) { cout << ______ << " "; } return 0; }
阅读以下程序,它的功能是什么?
#include <iostream> using namespace std; int main() { int weight; cout << "请输入药材重量(克):"; cin >> weight; if (weight > 100) { cout << "使用大号药碾" << endl; } else { cout << "使用小号药碾" << endl; } return 0; }
以下代码运行后,变量 result 的值是多少?
int brocade = 10; int embroidery = 6; int dye = 4; int result = brocade + embroidery * 2 - dye;