如何解决子程序中定义的格式给我错误,它是未定义的?
收到此错误时我有点困惑,因为我已经清楚地定义了我的格式,但我一直收到以下错误:
26 | write(string,100) 'The area of triangle with sides',sidea,',sideb,and ',sidec,' is',Area(sidea,sidec)
|
1
Error: FORMAT label 100 at (1) not defined
praclect15#3.f90:29:108:
29 | write(string,200) 'The area of triangle with sides',' is not possible.'
|
1
Error: FORMAT label 200 at (1) not defined
这是我的子程序:
contains
subroutine tri(sidea,string)
implicit none
real,intent(in):: sidea,sidec
character(len=75),intent(out):: string
if (sidea>0 .and. sideb>0 .and. sidec>0 .and. sidea+sideb>sidec .and. sideb+sidec>sidea .and. sidec+sidea>sideb) then
write(string,sidec)
100 format(a,f5.2,a,5.2,f8.2)
else
write(string,' is not possible.'
200 format (a,a)
end if
end subroutine tri
real function area(Sa,Sb,Sc)
implicit none
real:: Sa,Sc,S
S=(Sa+Sb,Sc)/2
area=sqrt(S*(S-Sa)*(S-Sb)*(S-Sa))
end function area
我的子程序的目的是在可能的情况下(例如,当它满足 if 语句的指定条件时)使用局部函数计算三角形的面积。我似乎唯一的问题是格式未定义。但是我已经清楚地定义了它,所以我不太确定问题是什么。
谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。