diff --git a/xiangmu2.c b/xiangmu2.c new file mode 100644 index 0000000..67d7a79 --- /dev/null +++ b/xiangmu2.c @@ -0,0 +1,24 @@ +#include +struct Student + { + int num; + float a; + float b; + float c; + float d; + } ; +int main() +{ int i,j; + struct Student stu[3]; + for(i=0;i<3;i++) + { + scanf("%d%f%f%f",&stu[i].num,&stu[i].a,&stu[i].b,&stu[i].c); + } + stu[0].d=stu[0].a+stu[0].b+stu[0].c; + stu[1].d=stu[1].a+stu[1].b+stu[1].c; + stu[2].d=stu[2].a+stu[2].b+stu[2].c; + for(j=0;j<3;j++) + { + printf("学号 %d 高数成绩 %.1f 大学物理成绩 %.1f 英语成绩 %.1f 总成绩 %.1f\n",stu[j].num,stu[j].a,stu[j].b,stu[j].c,stu[j].d); + } +}