| 3 | 1/1 | 返回列表 |
| 查看: 478 | 回復(fù): 2 | |||
[交流]
【求助】為什么兩種寫法得到的值不一樣?
|
|
為什么把if語句放到不同的位置,結(jié)果就不一樣了呢?請(qǐng)大家?guī)兔Ψ治鲆幌拢嘀x。 寫法一(判斷語句為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 |
» 搶金幣啦!回帖就可以得到:
+5/1845
+2/474
+1/88
+1/85
+1/84
+1/83
+1/61
+1/53
+2/52
+1/33
+1/25
+1/18
+1/17
+1/13
+1/11
+1/9
+1/4
+1/3
+1/3
+1/2
至尊木蟲 (職業(yè)作家)
| 3 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 南京大學(xué)化學(xué)376求調(diào)劑 +3 | hisfailed 2026-03-19 | 6/300 |
|
|---|---|---|---|---|
|
[考研] 295求調(diào)劑 +4 | 一志愿京區(qū)211 2026-03-18 | 6/300 |
|
|
[考研] 330求調(diào)劑 +4 | 小材化本科 2026-03-18 | 4/200 |
|
|
[考研] 288求調(diào)劑 +16 | 于海海海海 2026-03-19 | 16/800 |
|
|
[考研] 317求調(diào)劑 +5 | 申子申申 2026-03-19 | 9/450 |
|
|
[考研]
|
然11 2026-03-19 | 4/200 |
|
|
[考研] 求調(diào)劑一志愿南京航空航天大學(xué)289分 +3 | @taotao 2026-03-19 | 3/150 |
|
|
[考研] 353求調(diào)劑 +3 | 拉鉤不許變 2026-03-20 | 3/150 |
|
|
[考研] 工科材料085601 279求調(diào)劑 +7 | 困于星晨 2026-03-17 | 9/450 |
|
|
[考研] 265求調(diào)劑 +8 | 梁梁校校 2026-03-17 | 8/400 |
|
|
[考研] 286分人工智能專業(yè)請(qǐng)求調(diào)劑愿意跨考! +3 | lemonzzn 2026-03-17 | 4/200 |
|
|
[考研] 0703化學(xué)調(diào)劑 +4 | 18889395102 2026-03-18 | 4/200 |
|
|
[考研] 085601材料工程專碩求調(diào)劑 +10 | 慕寒mio 2026-03-16 | 10/500 |
|
|
[考研] 一志愿天津大學(xué)化學(xué)工藝專業(yè)(081702)315分求調(diào)劑 +11 | yangfz 2026-03-17 | 11/550 |
|
|
[考研] 材料考研調(diào)劑 +3 | xwt。 2026-03-19 | 3/150 |
|
|
[考研] 材料工程專碩274一志愿211求調(diào)劑 +6 | 薛云鵬 2026-03-15 | 6/300 |
|
|
[考研] 070303 總分349求調(diào)劑 +3 | LJY9966 2026-03-15 | 5/250 |
|
|
[考研] 0856專碩279求調(diào)劑 +5 | 加油加油!? 2026-03-15 | 5/250 |
|
|
[考研] 復(fù)試調(diào)劑 +3 | 呼呼?~+123456 2026-03-14 | 3/150 |
|
|
[考研] 一志愿哈工大材料324分求調(diào)劑 +5 | 閆旭東 2026-03-14 | 5/250 |
|