‹ 上一题 下一题 ›

g3-03782. GESP-3级-2026-09-单选-第09题 未做

下列程序是分别判断输入的 N 个数是否可能是二进制、八进制、十进制、十六进制,横线处应该填入的是(  )

#include <iostream>
using namespace std;
int main() {
    int n = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        char str[11];
        cin >> str;
        char max = '0';
        for (int i = 0; str[i] != '\0'; i++)
            if (str[i] > max)
                max = str[i];
        _____________________________
    }
    return 0;
}
  • A. cout << (max <= '1') << " " << (max <= '7') << " " << (max <= '9') << " " << (max <= 'F') << endl;
  • B. cout << (max <= 1) << " " << (max <= 7) << " " << (max <= 9) << " " << (max <= 'F') << endl;
  • C. cout << (max <= 1) << " " << (max <= 7) << " " << (max <= 9) << " " << (max <= F) << endl;
  • D. cout << (max >= 1) << " " << (max >= 7) << " " << (max >= 9) << " " << (max >= F) << endl;
未选择
输入
输出

            
答案