#include"iostream.h"
#include"stdio.h"
#include"string.h"
struct Date
{
int day,month,year;
};
struct Student
{
int numb;
char name[16];
Date birthDate;
};
void main()
{
Student stu1 = {001,"zhangxu",{16,5,1995}};
cout<<"学生的编号是:"<<stu1.numb<<endl;
cout<<"学生的姓名是:"<<stu1.name<<endl;
cout<<"学生的生日是:"<<stu1.birthDate.year<<"年"<<stu1.birthDate.month<<"月"<<stu1.birthDate.day<<"日"<<endl;
}
【C++】如何使用嵌套结构
最新推荐文章于 2024-03-08 16:28:04 发布