#3327. [GESP202309 五级 C++] 第 9 题

[GESP202309 五级 C++] 第 9 题

有关下面C++代码正确的是( )。

#include <iostream>
using namespace std;

bool isOdd(int N) {
    return N % 2 == 1;
}
int Square(int N) {
    return N * N;
}
bool checkNum(bool (*Fx)(int), int x) {
    return Fx(x);
}
int main() {
    cout << checkNum(isOdd, 10) << endl;   // 输出行A
    cout << checkNum(Square, 10) << endl;  // 输出行B
    return 0;
}

{{ select(1) }}

  • checkNum() 函数定义错误。
  • 输出行 A 的语句将导致编译错误。
  • 输出行 B 的语句将导致编译错误。
  • 该代码没有编译错误。