#2683. [GESP202306 三级 C++] 第 15 题

[GESP202306 三级 C++] 第 15 题

在下列代码的横线处填写( ),可以使得输出不是"31"。

#include <iostream>
using namespace std;
int main() {
    int array[5] = {1, 2, 4, 8, 16};
    int res = 0;
    for (int i = 0; i < 5; i++)
        ______; // 在此处填写代码
    cout << res << endl;
    return 0;
}

{{ select(1) }}

  • res = res + array[i]
  • res = res & array[i]
  • res = res | array[i]
  • res = res ^ array[i]