
fortran程序出错
programcalculatereal::x,y,fwrite(*,*)'Pleaseencounterxandy'read(*,*)x,ywrite(*,*)'xan...
program calculate
real::x,y,f
write (*,*) 'Please encounter x and y'
read (*,*) x,y
write (*,*) 'x and y are:', x,y
if (x>=0.) and (y>=0.) then
f=x+y
else if (x>=0.) and (y<0.) then
f=x+y**2
else if (x<0.) and (y>=0.) then
f=x**2+y
else
f=x**2+y**2
end if
write (*,*) 'f=', f
end
出错提示
错误 1 error #5082: Syntax error, found IDENTIFIER 'THEN' when expecting one of: ( % [ . = => C:\Projects\project1\project1\Source1.f90 6
错误 2 error #5082: Syntax error, found IDENTIFIER 'AND' when expecting one of: THEN C:\Projects\project1\project1\Source1.f90 8
错误 3 error #5082: Syntax error, found IDENTIFIER 'AND' when expecting one of: THEN C:\Projects\project1\project1\Source1.f90 10
警告 4 warning #7532: The number of arguments is incompatible with intrinsic procedure, assume 'external'. [AND] C:\Projects\project1\project1\Source1.f90 6
错误 5 error #6410: This name has not been declared as an array or a function. [AND] C:\Projects\project1\project1\Source1.f90 6
错误 6 error #6305: An ELSE statement occurred without a corresponding IF THEN statement. C:\Projects\project1\project1\Source1.f90 12
错误 7 error #6317: An ENDIF occurred without a corresponding IF THEN or ELSE statement. C:\Projects\project1\project1\Source1.f90 14
错误 8 Compilation Aborted (code 1) C:\Projects\project1\project1\Source1.f90 1 展开
real::x,y,f
write (*,*) 'Please encounter x and y'
read (*,*) x,y
write (*,*) 'x and y are:', x,y
if (x>=0.) and (y>=0.) then
f=x+y
else if (x>=0.) and (y<0.) then
f=x+y**2
else if (x<0.) and (y>=0.) then
f=x**2+y
else
f=x**2+y**2
end if
write (*,*) 'f=', f
end
出错提示
错误 1 error #5082: Syntax error, found IDENTIFIER 'THEN' when expecting one of: ( % [ . = => C:\Projects\project1\project1\Source1.f90 6
错误 2 error #5082: Syntax error, found IDENTIFIER 'AND' when expecting one of: THEN C:\Projects\project1\project1\Source1.f90 8
错误 3 error #5082: Syntax error, found IDENTIFIER 'AND' when expecting one of: THEN C:\Projects\project1\project1\Source1.f90 10
警告 4 warning #7532: The number of arguments is incompatible with intrinsic procedure, assume 'external'. [AND] C:\Projects\project1\project1\Source1.f90 6
错误 5 error #6410: This name has not been declared as an array or a function. [AND] C:\Projects\project1\project1\Source1.f90 6
错误 6 error #6305: An ELSE statement occurred without a corresponding IF THEN statement. C:\Projects\project1\project1\Source1.f90 12
错误 7 error #6317: An ENDIF occurred without a corresponding IF THEN or ELSE statement. C:\Projects\project1\project1\Source1.f90 14
错误 8 Compilation Aborted (code 1) C:\Projects\project1\project1\Source1.f90 1 展开
2个回答
展开全部
fortran逻辑表达式中,and两边必须各有一个英文句点;
长表达式最好用括号括起来,调试程序或再读程序的时候,方便,一目了然
已赞过
已踩过<
评论
收起
你对这个回答的评价是?

2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询