[問題] 好像是字元邏輯的問題..

看板Fortran作者 (kicala)時間15年前 (2009/05/29 03:27), 編輯推噓1(105)
留言6則, 4人參與, 最新討論串1/2 (看更多)
出現 Variable I has been used without being given an initial value I,J,K都有這樣我沒辦法下去。 跑是可以跑可是附程式叫不出來,拜託前輩們 program intergran sin implicit none real::a,b,h,dx integer::s character(len=20)::skill,i,j,k write(*,*)"function:sin key in upper & under " read(*,*)a,b h=a-b write(*,*)"key in how many subintervals ?" read(*,*)s dx=h/real(s) write(*,*)"select a skill " write(*,*)"(i)simspon rule" write(*,*)"(j)rectangule rule" write(*,*)"(k)trapezoidal rule" read(*,*)skill ---------------------------------- if (skill==i) then 我 call simspon 想 else if(skill==j) then 問 call rectangule 題 else if(skill==k) then 在 call trapezoidal 這 end if end program subroutine simspon implicit none write(*,*)"integran by simspon rule" end subroutine rectangule implicit none write(*,*)"integran by rectangule rule" end subroutine trapezoidal implicit none write(*,*)"integran by trapezoidal rule" end 謝謝 orz -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.169.151.243

05/29 04:07, , 1F
你的第一行就是答案了...(題外話 simspon = 辛氏積分??)
05/29 04:07, 1F

05/29 04:11, , 2F
(skill=="i")
05/29 04:11, 2F

05/29 12:20, , 3F
不好意識唷..其實我不知道要如何改
05/29 12:20, 3F

05/29 12:40, , 4F
給二樓,加"AA"還是叫不出來耶..
05/29 12:40, 4F

05/29 18:05, , 5F
i,j,k沒給值他是要怎麼比對? 要依照你skill給什麼吧
05/29 18:05, 5F

05/29 19:03, , 6F
我懂了!!! 謝謝唷
05/29 19:03, 6F
文章代碼(AID): #1A7kMYuO (Fortran)
文章代碼(AID): #1A7kMYuO (Fortran)