| 查看: 444 | 回复: 2 | |||
[交流]
【求助】为什么两种写法得到的值不一样?
|
|
为什么把if语句放到不同的位置,结果就不一样了呢?请大家帮忙分析一下,多谢。 写法一(判断语句为h0(t)/=0): t0=0 do ntel=1, npoints neworig = .false. if (t0.eq.0) then neworig = .true. elseif (ntel-time0(t0).eq.it0)then neworig = .true. endif if (neworig) then t0 = t0 + 1 ! update number of t=0 time0(t0) = ntel ! store the time of t=0 h0(t0) = h(ntel) endif do t=1, t0 ! update tcf for t=0 delt=ntel-time0(t)+1 ! actual time minus t=0 if(h0(t)/=0.and.(delt.lt.npoints)) then ntime(delt) = ntime(delt)+1d0 tcf(delt)=tcf(delt)+h(ntel)*h0(t) tcf0(delt)=tcf0(delt)+h0(t)*h0(t) endif enddo enddo 写法二(判断语句为if (h(ntel)/=0) then) t0=0 do ntel=1, npoints neworig = .false. if (h(ntel)/=0) then if (t0.eq.0) then neworig = .true. elseif (ntel-time0(t0).eq.it0)then neworig = .true. endif endif if (neworig) then t0 = t0 + 1 ! update number of t=0 time0(t0) = ntel ! store the time of t=0 h0(t0) = h(ntel) endif do t=1, t0 ! update tcf for t=0 delt=ntel-time0(t)+1 ! actual time minus t=0 if(delt.lt.npoints) then ntime(delt) = ntime(delt)+1d0 tcf(delt)=tcf(delt)+h(ntel)*h0(t) tcf0(delt)=tcf0(delt)+h0(t)*h0(t) endif enddo enddo |
» 猜你喜欢
需要合成515-64-0,50g,能接单的留言
已经有5人回复
上海工程技术大学【激光智能制造】课题组招收硕士
已经有6人回复
带资进组求博导收留
已经有11人回复
自荐读博
已经有5人回复
求个博导看看
已经有16人回复
上海工程技术大学张培磊教授团队招收博士生
已经有4人回复
求助院士们,这个如何合成呀
已经有4人回复
临港实验室与上科大联培博士招生1名
已经有9人回复
写了一篇“相变储能技术在冷库中应用”的论文,论文内容以实验为主,投什么期刊合适?
已经有6人回复
最近几年招的学生写论文不引自己组发的文章
已经有11人回复
» 抢金币啦!回帖就可以得到:
华中科技大学龚江研究员课题组诚招博士研究生、科研助理和博士后
+3/210
Analytical Science Advances(Wiley出版社)长期征稿中...
+1/81
广州
+1/71
有南京的小伙伴吗,蹲个男朋友
+1/53
Analytical Science Advances(Wiley出版社)长期征稿中...
+1/35
西南交通大学前沿院碳中和与物质循环利用课题组招收博士生
+1/31
浙江师范大学申利国教授招聘博士后研究人员
+1/30
博士招生
+1/26
山东大学集成电路学院博士招生1名
+1/12
重庆大学前沿院,黄小洋教授课题组,招收2026年非均相催化方向学术博士2名
+1/11
国家青年人才叶立群教授课题组招收2026级博士研究生
+1/9
天津大学化学系吴立朋课题组申请考核制博士招生/博后招聘
+1/9
某外资仪器厂家急招技术销售工程师-苏州
+1/5
湖南大学机械与运载工程学院赵岩副教授课题组招生2026级普通博士生1名
+1/4
经济学博士(金融方向)招生,211重点大学,2026年9月入学,申请-考核制。
+1/3
博士后网站系统登录
+1/2
知名外资仪器厂家急招Application Scientist
+1/2
【博士招生】AI+材料/能源及海上能源岛方向有若干申请考核制名额
+1/2
海南大学!海洋与极地地质团队长期招收博士和博士后
+1/1
论文投稿推荐
+1/1
2楼2011-02-13 10:18:59
3楼2011-02-13 10:24:20







回复此楼