这段代码只能显示学号和成绩,如何实现显示姓名?完整代码:
#include<stdio.h>
struct Student
{int num;
float score;
struct Student*next;
};
int main()
{struct Student a,b,c,d,*head,*p;
a.num=202101;a.score=93.7;
b.num=202102;b.score=94.1;
c.num=202103;c.score=93.8;
d.num=202104;d.score=93.9;
head=&a;
a.next=&b;
b.next=&c;
c.next=&d;
d.next=NULL;
p=head;
do
{printf("%ld%5.1f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
return 0;
}
运行结果(不知如何上传图片,用文字表示):
202101 93.7
202102 94.1
202103 93.8
202104 93.9
我想让运行结果变为:
202101 xiaoming 93.7
202102 xiaowei 94.1
202103 xiaotian 93.8
202104 xiaodu 93.9
请问该如何添加代码?