You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
676 B
32 lines
676 B
#include <stdio.h>
|
|
//定义结构体
|
|
struct Student
|
|
{
|
|
int ID;//学号
|
|
float math_grade;
|
|
float physics_grade;
|
|
float English_grade;
|
|
float sum;
|
|
};
|
|
|
|
|
|
int main()
|
|
{
|
|
struct Student information[3];
|
|
for(int i=0;i<3;i++)
|
|
{
|
|
scanf("%d%f%f%f",&information[i].ID,&information[i].math_grade,\
|
|
&information[i].physics_grade,&information[i].English_grade);
|
|
information[i].sum=information[i].math_grade+\
|
|
information[i].physics_grade+information[i].English_grade;
|
|
}
|
|
|
|
for(int i=0;i<3;i++)
|
|
{
|
|
printf("%d %.1f %.1f %.1f %.1f\n",information[i].ID,\
|
|
information[i].math_grade,information[i].physics_grade,\
|
|
information[i].English_grade,information[i].sum);
|
|
}
|
|
}
|
|
|