|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD>ṹ<EFBFBD><E1B9B9>
|
|
|
|
|
struct Student {
|
|
|
|
|
int id;
|
|
|
|
|
float mathScore;
|
|
|
|
|
float physicsScore;
|
|
|
|
|
float englishScore;
|
|
|
|
|
float totalScore;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void inputStudentInfo(struct Student* student);
|
|
|
|
|
void displayStudentInfo(struct Student* student);
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7>
|
|
|
|
|
struct Student student1, student2, student3;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
inputStudentInfo(&student1);
|
|
|
|
|
inputStudentInfo(&student2);
|
|
|
|
|
inputStudentInfo(&student3);
|
|
|
|
|
|
|
|
|
|
// <20><>ʾѧ<CABE><D1A7><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
displayStudentInfo(&student1);
|
|
|
|
|
displayStudentInfo(&student2);
|
|
|
|
|
displayStudentInfo(&student3);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
|
|
|
|
|
void inputStudentInfo(struct Student* student) {
|
|
|
|
|
scanf("%d", &student->id);
|
|
|
|
|
scanf("%f", &student->mathScore);
|
|
|
|
|
scanf("%f", &student->physicsScore);
|
|
|
|
|
scanf("%f", &student->englishScore);
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ܳɼ<DCB3>
|
|
|
|
|
student->totalScore = student->mathScore + student->physicsScore + student->englishScore;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><>ʾѧ<CABE><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
|
|
|
|
|
void displayStudentInfo(struct Student* student) {
|
|
|
|
|
printf("%d %.1f %.1f %.1f %.1f\n", student->id, student->mathScore, student->physicsScore, student->englishScore, student->totalScore);
|
|
|
|
|
}
|