#include<stdio.h>
struct student
{
char number[3];
char name[20];
float score[3];
float aver;
};
int main()
{
struct student stu[3];
int i,max;
printf("请输入三位学生的学号、姓名、3门课的成绩:\n");
for(i=0;i<3;i++)
{
scanf("%s%s%f%f%f",stu[i].number,stu[i].name,&stu[i].score[0],&stu[i].score[1],&stu[i].score[2]);
stu[i].aver=(stu[i].score[0]+stu[i].score[1]+stu[i].score[2])/3;
}
printf("学号 姓名 c语言 高数 英语 平均\n");
for(i=0;i<3;i++)
{
printf("%-5s %-5s %-6.2f %-6.2f %-6.2f %-6.2f\n",stu[i].number,stu[i].name,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].aver);
}
}
點擊查看更多內容
5人點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優質文章
正在加載中
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦