代码:
#include<stdio.h>
#include<string.h>
struct date
{
int year;
int month;
int day;
};
struct stu
{
int num;
char name[20];
char sex;
struct date birth;
float score;
};
int main()
{
struct stu s1 = {10010,"zhangsan",'m',2000,5,4,84.5}, s2, s3;
scanf("%d%s%c%d%f",&s2.num,&s2.name,&s2.sex,&s2.date,&s2.score);
s3=s1;
s1=s2;
s2=s3;
printf("学号:%d\n姓名:%s\n性别:%c\n出生日期:%d\n成绩:\n",s1.num,s1.name,s1.sex,s1.date,s1.score);
printf("学号:%d\n姓名:%s\n性别:%c\n出生日期:%d\n成绩:\n",s2.num,s2.name,s3.sex,s3.date,s3.score);
return 0;
}
运行结果: