主题:请大神修改一下程序,我初学,怎么都改不好了
从键盘输入5名学生的姓名、英语成绩、F90成绩,求每个学生的平均成绩和5名学生的班级平均成绩,根据每个学生平均成绩将学生分成A、B、C三个等级,大于班级平均成绩10分者为A等,小于班级平均成绩10分者为C等,其余为B等。输出每个学生姓名、英语成绩、F90成绩、平均成绩、等级,以及班级平均成绩。使用派生类型设计和编写程序。
说明:姓名最多4个汉字,成绩取小数1位。
program xscj2
implicit none
type
integer,parameter :: n=5.
type student
character(8) :: name
real(4) e_score
real(4) f_score
real(4) av_score
character grade
end type
type(student),dimension(n)::student information
real(4)sum=0,classav
integer i
student information(1),name ="zhangsan";student information(1),e_score=80.;student information(1),f_score=96.
student information(2),ame ="lisi";student information(2),e_score=75.;student information(2),f_score=77.
student information(3),name ="wangwu";student information(3),e_score=77.;student information(3),f_score=88.
student information(4),name ="liuer";student information(4),e_score=64.;student information(4),f_score=99.
student information(5),name ="zhuchen";student information(5),e_score=70.;student information(5),f_score=90.
do i=1,n
student information(i),av_score=(student information(i),e_score+student information(i),f_score)/2.
sum=sum+student information(i),av_score
end do
classav = sum / real (n)
do i=1,n
if( sum=sum+student information(i),av_score>=classav+10.) student information(i) ,grade="A"
if( sum=sum+student information(i),av_score<=classav) student information(i) ,grade="B"
if( sum=sum+student information(i),av_score<=classav-10.) student information(i) ,grade="C"
write (*,100)student information
100format (1x,A8,3(1x.F6.2),(x,A2))
end do
end program xscj2