为了账号安全,请及时绑定邮箱和手机立即绑定

请高手指教,程序和编译器出错提示如下:

请高手指教,程序和编译器出错提示如下:

哈士奇WWW 2023-03-02 20:16:11
当我用一个function,用contains包含另外一个function 时就出错了  不用contains 结构,分开写,就又没问题了function se(x) implicit noneinteger nreal x,h,he,tx,sen=1tx=h(n)*x**(2*n)he=txdo while(abs(tx)>=1e-10)n=n+1tx=h(n)*x**(2*n)he=he+txenddose=1+hecontainsfunction h(n) result(k)implicit noneinteger i,nreal pim,term1,term2,e,s,kpim=(2/3.1415926)**(2*n+1)term1=1term2=1e=term1/term2s=1i=1do while(abs(e)>=1e-10)i=i+1term1=(-1.0)**(real(i)-1)term2=(2*real(i)-1)**(2*n+1)e=term1/term2s=s+eenddok=2*pim*send function hend function seprogram eximplicit nonereal se,xread*,xprint*,se(x)endD:\My Documents\fortran save\Text1.f90(15) : Error: The name of the internal procedure conflicts with a name in the encompassing scoping unit. [H]function h(n) result(k)
查看完整描述

3 回答

?
ABOUTYOU

TA贡献1812条经验 获得超5个赞

用contains包含之后不能再在函数se中声明h了,
real x,h,he,tx,se
去掉h
real x,he,tx,se

查看完整回答
反对 回复 2023-03-06
?
aluckdog

TA贡献1847条经验 获得超7个赞

错误文件你可以从软件库中删除,
也可以通过调用 Microsoft 产品支持服务请求

查看完整回答
反对 回复 2023-03-06
?
GCT1015

TA贡献1827条经验 获得超4个赞

我也是书上看的哈,你试下行不行
最前面加一个module blala
第二行implicit none
把cantains写到第三行
最后加一个end module bala
这个module bala就包括了两个子函数
主程序里面调用写use bala

查看完整回答
反对 回复 2023-03-06
  • 3 回答
  • 0 关注
  • 305 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号