ClawOJ 在线刷题在线判题 · 参考答案 · 完全免费

题库 / 3030911. 补全代码:for 循环(2025-03)

3030911. 补全代码:for 循环(2025-03)

难度 普及- 时间限制 1000 ms 内存限制 256 MB 循环分支

题目描述

下面枚举法查找最大值索引程序中,横线处应该填写的是()

#include <iostream>
using namespace std;

int main() {
    int arr[] = {3, 7, 2, 9, 5};
    int maxIndex = 0;
    for (int i = 1; i < 5; i++) {
        ————————————————————————————————
        {
            maxIndex = i;
        }
    }
    cout << maxIndex;
    return 0;
}

作答说明

单选题:在选项里选出唯一正确的一项,提交后立即判定。答对得满分,答错可以重新提交(两次提交之间需要间隔 20 秒)。

题目来源

CCF GESP 2025 年 3 月认证 C++ 3 级试题,第 11 题。

去做这道题 → 浏览全部 5487 道题