Re: [问题] 开文件求平均

楼主: cloudo (一步一脚印)   2013-11-25 11:57:32
※ 引述《Laoda245566 (草莓兽)》之铭言:
: integer x, y, sum
: real mean
: open(unit=1,file='Gradeold.txt')
: read(1,*)x,y
: sum=0
: do i=1,62
: sum=sum+y
: end do
: mean=sum/62
: write(*,*)"mean",mean
: end
: 请问一下
: 哪里打错了
: 我怎么执行都是100
: 感谢
Program Test1
implicit none
integer x,i
real mean, y(1000), sum
open(unit=1,file='Gradeold.txt')
do i=1,62
read(1,*) x,y(i)
end do
sum=0
do i=1,62
sum=sum+y(i)
end do
mean=sum/62
write(*,*)"mean",mean
stop
end program
待业中无聊一Po
作者: charlesdc (MoOn)   2012-01-26 01:17:00
拜托这种作业文就别回了...... 只会让他一直上来发问

Links booklink

Contact Us: admin [ a t ] ucptt.com