GESP C++ 真题 · 逐题精解
首页C++四级真题 › 2025年6月 › 第3题

GESP 2025年6月 C++四级 判断题 第3题

C++四级判断题2025年6月第3题

所属知识点:结构体 难度要求:掌握 考频:—

下面 C++ 代码在一个结构体中又定义了别的结构体。这种结构嵌套定义的方式语法不正确。
#include <string>
#include <vector>
using namespace std;
struct Library {
struct Book {
struct Author {
string name;
int birthYear;
};
string title;
int year;
Author author;
};
string name;
vector<Book> books;
};

正确答案:错误(×)

题目解析
错。结构体中嵌套定义另一个结构体在语法上是正确的。

想系统刷完 GESP C++ 1~8 级真题,并查看每道题的逐题精讲?

进入 GESPPASS 开始练习