[問題] 有人會這一題嗎?
有人會把以下輸出嗎??
program dograde
integer,parameter :: num=20, sn=5
type :: member
integer :: id, psum=0
end type
type :: grades
integer :: sub(sn)=0
end type
type(grades) :: psub(num),totalave
type(member) :: person(num)
open(10,file="grade.txt",form="unformatted",access="direct",recl=4*sn*num)
do i=1,num
person(i)%id=i
read(10,rec=i) psub(i)
do j=1,sn
totalave%sub(j) = totalave%sub(j) + psub(i)%sub(j)
person(i)%psum = person(i)%psum + psub(i)%sub(j)
end do
end do
! 每個人總成績
do i=1,num
write(*,*) person(i)%id, person(i)%psum
end do
! 各科平均
do j=1,sn
write(*,*) real(totalave)/read(num)
end do
stop
end program
ps:我是用我朋友的帳號po的!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.42.218.4
噓
06/18 18:37, , 1F
06/18 18:37, 1F
噓
06/18 19:03, , 2F
06/18 19:03, 2F
噓
06/18 19:44, , 3F
06/18 19:44, 3F
Fortran 近期熱門文章
PTT數位生活區 即時熱門文章