首页 > 解决方案 > 错误: (1) 处的不可分类声明?在 do while 语句下的行

问题描述

我正在创建一个程序,该程序将在文件中获取数字并将它们平均并创建标准偏差;但是,当我编译程序时,我收到一个错误,指出 (1) 处的 Unclassifiable 语句,它在编译器中位于 do while 语句的正下方。有人对为什么会这样有任何意见吗?我被引导相信我的语法不正确,但不确定在哪里。

implicit none

!declaring the single precision for real numbers, array, and variables.
integer :: firstnumber, i
real*4 :: average, sum_, standarddeviation

real*4, allocatable :: arrayone(:)!making sure that the array is single precision real

open(1,file='Numbers1.txt')!opening file

do i = 1, 10
    read(1,*) firstnumber!reading the first number
end do

allocate(arrayone(firstnumber))!allocating the array with the first number variable obtained from previous statement

i = 2

do while i < 60000 

    i = i + 1
    read(i,*)
    sum_ = Sum(arrayone) !sums all of the numbers from arrayone
    average = Sum_/float firstnumber !calculates the average or mean of the data set
    standarddeviation = sqrt(sum_ - average) * (sum_ - average)!calculates the standard deviation of the data set

print,"Average = "average
print,"Standard Deviation = "standarddeviation

deallocate(arrayone)!Deallocating arrayone}
close(1)

print*,"Done!"

end program Assignmentthree

标签: fortrangfortranfortran95

解决方案


推荐阅读