fortran - 错误: (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
解决方案
推荐阅读
- regex - 正则表达式量词不限制匹配
- wordpress - ID 的 WP_Query 参数设置
- java - Tess4J 从源代码正常工作,但不能从 JAR
- html - LinkedIn 链接并不总是显示在 Angularjs 网站上
- php - PHP PDO、Ubuntu、MDBTools 连接到 Access 数据库的问题
- node.js - 通过坐标解析 xls 文件 [Node.JS]
- mysql - macOS 上的 mysql 设置
- twitter-bootstrap - 在 scala-js 应用程序中使用 bootstraptoggle 的 onclick 事件
- c# - 将列表中的某些元素求和,该列表由 C# 中的字符串组成
- javascript - 在 React Konva 中使用 globalCompositeOperation 来掩盖形状组