编写一个程序输出10个学生的姓名,性别,总分,语文,数学,外语成绩的成绩单。
include
struct Student
{int num;
char name[50];
char sex;
int score[4];};
struct Student stu[10]={
{1011,"李小明",'M',{100,101,103,304}},{1012,"李山峰",'M',{98,120,130,358}},{1013,"王小楠",'F',
{95,99,112,307}},{1014,"刘好好",'M',{99,98,89,296}},{1015,"张小凤",'M',{90,106,44,210}},{1016,"王琳琳",'F',{99,130,140,369}},
{1017,"李小钢",'F',{89,130,132,251}},{1018,"王明明",'M',{88,100,100,288}},{1019,"陈春天",'M',{123,132,145,400}},{1020,
"赵大山",'F',{132,130,140,402}}};
main()
{struct Student p;
printf("学号 姓名 性别 语文 数学 外语 总分\n");
for(p=stu;p<stu+10;p++)
printf("%5d %12s %6c %6d %7d %7d %7d\n",(p).num,(p).name,(p).sex,(p).score[0],(p).score[1],(p).score[2],(p).score[3]);
}