#include #include typedef struct student{ long ID; char name[15]; int age; float s; float y; float c; float w; float g; float x; float aver; }STU; void Input(STU *stu) { scanf("%ld",&(*stu).ID); scanf("%s",(*stu).name); scanf("%d",&(*stu).age); scanf("%f",&(*stu).s); scanf("%f",&(*stu).y); scanf("%f",&(*stu).c); scanf("%f",&(*stu).w); scanf("%f",&(*stu).g); scanf("%f",&(*stu).x); } float AverScore(STU stu) { float total_score = stu.s * 4 + stu.y * 3 + stu.c * 4 + stu.w * 3 + stu.g * 3 + stu.x * 3; float total_weight = 4 + 3 + 4 + 3 + 3 + 3; // 总权重 stu.aver = total_score / total_weight; // 计算平均分数 return stu.aver; } void Output(STU stu) { printf("%ld ", stu.ID); printf("%s ", stu.name); printf("%d\n", stu.age); } int main() { STU stu; Input(&stu); float ret = AverScore(stu); Output(stu); printf("%.0f", ret); return 0; }