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.

33 lines
804 B

#include <stdio.h>
typedef struct Student{
int id;
float math_score;
float physics_score;
float english_score;
float total_score;
}Student;
void inputStudentinfo(Student *student){
scanf("%d", &student->id);
scanf("%f", &student->math_score);
scanf("%f", &student->physics_score);
scanf("%f", &student->english_score);
student->total_score = student->math_score + student->physics_score + student->english_score;
}
void outputStudentinfo(Student student){
printf("%05d %.1f %.1f %.1f %.1f\n",student.id, student.math_score, student.physics_score, student.english_score, student.total_score);
}
int main(){
Student student[3];
int i;
for(i=0;i<3;i++){
inputStudentinfo(&student[i]);
}
for(i=0;i<3;i++){
outputStudentinfo(student[i]);
}//步骤二
return 0;
}