- 积分
- 88
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-8-26
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2014-8-31 19:44:25
|
显示全部楼层
你好,我把这些数组赋值为0后,值还是没变还是>1,不知道哪错了program main
integer i,j
integer a(662,50)
real p(662),q(662),m(662),d(662)
open (1,file='8.31.txt')
do i=1,662
read(1,*) (a(i,j),j=1,50)
end do
do i=1,662
m(i)=0.0
p(i)=0.0
q(i)=0.0
d(i)=0.0
end do
do i=1,662
do j=1,50
m(i)=m(i)+a(i,j)
end do
m(i)=m(i)/50
!print *,m(i)
end do
print *,1111
do i=1,662
do j=1,50
p(i)=p(i)+(a(i,j)-m(i))*(j-25.5)
q(i)=q(i)+(a(i,j)-m(i))*(a(i,j)-m(i))*(j-25.5)*(j-25.5)
end do
end do
do i=1,662
d(i)=p(i)/sqrt(q(i)*1.0)
end do
open (2,file='2.txt')
do i=1,662
write(2,'(662f7.2)') d(i)
end do
end
|
|