选择题 共15道
判断题 共5道
执行下列代码,输入“Yunnan Hani Rice Terraces”(不带引号),输出结果为?
string place; cin >> place; cout << place;
定义结构体记录民族服饰信息如下,执行 cout << shop[1].price + shop[2].stock; 输出的结果是?
struct Costume { char name[20]; int price; int stock; }; Costume shop[3] = {{"Miao Silver", 500, 8}, {"Tibetan Robe", 300, 12}, {"Yi Embroidery", 200, 20}};
以下是用冒泡排序模拟蒙古族游牧迁徙距离从小到大排列的代码片段。请补全内层循环条件。
int dist[6] = {45, 30, 60, 25, 50, 35}; int n = 6; for (int i = 0; i < n-1; i++) { for (int j = 0; j < ______; j++) { if (dist[j] > dist[j+1]) swap(dist[j], dist[j+1]); } }
以下程序段可以交换两个整数 x 和 y 的值:
int x=6, y=10;
x = x + y;
y = x - y;
x = x - y;