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
1.1 KiB

1 year ago
#include <stdio.h>
int main() {
int studentID[3];
float mathScore[3], physicsScore[3], englishScore[3], totalScore[3];
// 录入学生信息
for (int i = 0; i < 3; i++) {
printf("请输入第%d个学生的学号", i+1);
scanf("%d", &studentID[i]);
printf("请输入第%d个学生的高数成绩", i+1);
scanf("%f", &mathScore[i]);
printf("请输入第%d个学生的大学物理成绩", i+1);
scanf("%f", &physicsScore[i]);
printf("请输入第%d个学生的英语成绩", i+1);
scanf("%f", &englishScore[i]);
totalScore[i] = mathScore[i] + physicsScore[i] + englishScore[i];
}
// 显示学生信息和总成绩
printf("\n学生信息和总成绩如下:\n");
for (int i = 0; i < 3; i++) {
printf("学号:%05d高数成绩%.1f,物理成绩:%.1f,英语成绩:%.1f,总成绩:%.1f\n",
studentID[i], mathScore[i], physicsScore[i], englishScore[i], totalScore[i]);
}
return 0;
}