大家帮忙看看Fortran中这个错误是什么?怎么改?
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/07/11 06:29:37
大家帮忙看看Fortran中这个错误是什么?怎么改?
open(1,file='data.txt')
\x09real h,v,a,t,f,v0,g,H0
\x09f=0.03
\x09t=0.1
\x09g=9.8
\x09H0=100
\x09a=g
\x09h=0
\x09v=0
\x09v0=sqrt(g/f)
\x09do while(hv0)then
\x09write(*,"(1x,F3.4)") v0
\x09else
\x09write(*,"(1x,F3.4)") v
\x09end if
\x09end do
\x09end
\x09
错误如下
F:\fortran hui\Text1.for(2) : Error: A specification statement cannot appear in the executable section.
real h,v,a,t,f,v0,g,H0
--------^
Error executing df.exe.
open(1,file='data.txt')
\x09real h,v,a,t,f,v0,g,H0
\x09f=0.03
\x09t=0.1
\x09g=9.8
\x09H0=100
\x09a=g
\x09h=0
\x09v=0
\x09v0=sqrt(g/f)
\x09do while(hv0)then
\x09write(*,"(1x,F3.4)") v0
\x09else
\x09write(*,"(1x,F3.4)") v
\x09end if
\x09end do
\x09end
\x09
错误如下
F:\fortran hui\Text1.for(2) : Error: A specification statement cannot appear in the executable section.
real h,v,a,t,f,v0,g,H0
--------^
Error executing df.exe.
![大家帮忙看看Fortran中这个错误是什么?怎么改?](/uploads/image/z/18093685-13-5.jpg?t=%E5%A4%A7%E5%AE%B6%E5%B8%AE%E5%BF%99%E7%9C%8B%E7%9C%8BFortran%E4%B8%AD%E8%BF%99%E4%B8%AA%E9%94%99%E8%AF%AF%E6%98%AF%E4%BB%80%E4%B9%88%3F%E6%80%8E%E4%B9%88%E6%94%B9%3F)
这个错误的意思是类型声明语句不能出现在执行语句部分.
Fortran中类型声明语句在最前面.你把类型声明语句放到open那句话前面就行了.
Fortran中类型声明语句在最前面.你把类型声明语句放到open那句话前面就行了.