执行下面C++代码后,输出是( )。
string str = "chen";
int x = str.length();
int temp = 0;
for (int i = 0; i <= x; i++) {
temp++;
}
cout << temp << endl;
- A. 4
- B. 2
- C. 5
- D. 3
正确答案:C
string str = "chen";
int x = str.length();
int temp = 0;
for (int i = 0; i <= x; i++) {
temp++;
}
cout << temp << endl;
正确答案:C
想系统刷完 GESP C++ 1~8 级真题,并查看每道题的逐题精讲?
进入 GESPPASS 开始练习