#include<stdio.h>
struct date
{
int year,month,day;
};
struct student
{
int num;
char name[10];
char sex;
struct date bday;
float score;
};
int main()
{
struct student s1,s2={10002,"Wang Li",'F',1982,5,23,89.5};
s1=s2;
printf("%d\n",s1.num);
printf("%s\n",s1.name);
printf("%c\n",s1.sex);
printf("%d-%d-%d\n",s1.bday.year,s1.bday.month,s1.bday.day);
printf("%.1f\n",s1.score);
return 0;
}
结构体——例题
最新推荐文章于 2024-08-19 16:01:20 发布