编程序输入30个学生的学号、姓名、3门课程的成绩,存入一个结构型的数组。统计并输出每个学生的学号、姓名、总分。

admin2016-12-25  24

问题 编程序输入30个学生的学号、姓名、3门课程的成绩,存入一个结构型的数组。统计并输出每个学生的学号、姓名、总分。

选项

答案main() {struct {10ng num; char name[ 20]; fioat score1; f1oat score2, f1oat score3 ; f1oat total; } stu[50]; int i, f1oat x1,x2,x3 ; for(i=0;i<30;i++ ) { scanf( "% ld,% s",&stu[i].num,stu [ i] ).name) ; stu[i] .score1 = x1,stu [i] .score2 = x2,stu[i] .score3 = x3 ; for(i =0;i< 30;1 ++ ) stu [i] .score1 = stu [ i] .score2 = x2,stu score2 + stu [ i],score3 ; for(i =0;1<30;i++ ) printf( "% ld name% f\n",stu[i] .num, stu[i] .total)

解析
转载请注明原文地址:https://kaotiyun.com/show/ykAx777K
0

最新回复(0)