出一道C++基础代码阅读选择题
时间: 2023-08-30 19:04:09 浏览: 89
自考C++试题及答案 (2).docx
好的,这是一道C++代码阅读选择题:
```c++
#include <iostream>
using namespace std;
int main() {
int x = 5;
int y = 2;
if (x > y) {
cout << "x is greater than y" << endl;
}
else if (x < y) {
cout << "x is less than y" << endl;
}
else {
cout << "x is equal to y" << endl;
}
return 0;
}
```
在上面的代码中,以下哪个语句会被输出?
A. x is greater than y
B. x is less than y
C. x is equal to y
D. 以上都不是
请回答正确的选项。
阅读全文