以下关于C++结构体的语法使用,代码写法正确的是?

pp864256 单选题 共 个子题

假设所有代码均已引入所需头文件(iostream、string),且使用using namespace std; 编译环境符合C++11及以上标准。

A
struct Student {
    int id;
    string name;
}
Student s;
s.id = 1001;
B
struct Student {
    int id;
    string name;
};
Student.id = 1001;
C
struct Student {
    int id;
    string name;
};
Student s = {1001, "张三"};
cout << s.name;
D
struct Student {
    int id;
private:
    string name;
};
Student s;
s.name = "张三";
正在加载题目数据…
已答 /
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析
讨论
发布
登录后参与讨论 立即登录
发布讨论需先绑定并验证手机号 去绑定手机号
加载中…
我
我
回复 @
回复 @
发送
还没有人讨论,来发表第一条吧