討論串[問題] linux上的指令
共 5 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓7(7推 0噓 7→)留言14則,0人參與, 最新作者bluehaerts (5858笨58)時間15年前 (2008/12/03 19:36), 編輯資訊
0
0
0
內容預覽:
program factor. real n. read(*,*) n. res=n*factorial(n-1). write(*,*)'n=>',res. end. function factorial(n). integer n,res. if (n .le. 1) then. res=1.
(還有162個字)

推噓1(1推 0噓 1→)留言2則,0人參與, 5年前最新作者agody (講不聽)時間15年前 (2008/12/04 02:52), 編輯資訊
1
0
0
內容預覽:
如果題目是要算階乘(我不知道題目是啥啦). 又規定要用函式來用遞迴. program factor. read(*,*) n. nres=ifn(n). write(*,*)'n=>',nres. end. RECURSIVE function ifn(n). if (n .eq. 1) then.
(還有9個字)

推噓1(1推 0噓 6→)留言7則,0人參與, 5年前最新作者bluehaerts (5858笨58)時間15年前 (2008/12/04 12:39), 編輯資訊
0
0
0
內容預覽:
我測試跑過了 出現這個結果 應該是說 沒有主程式喔. ooop.f:7:. RECURSIVE function ifn(n). 1 2. Unrecognized statement name at (1) and invalid form for assignment or statement-
(還有48個字)

推噓1(1推 0噓 5→)留言6則,0人參與, 最新作者bluehaerts (5858笨58)時間15年前 (2008/12/04 12:48), 編輯資訊
0
0
0
內容預覽:
program fun. real x, y. real , external :: f. do while (.true.). read(*,*) x ! 使用者輸入 x. y = f(x) ! 呼叫f函數計算x2-2x+1. print *, y. end do. end. real funct
(還有203個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者agody (講不聽)時間15年前 (2008/12/04 16:02), 編輯資訊
0
0
0
內容預覽:
不支援RECURSIVE就用間接的. 寫兩個一樣的function互call. program factor. read(*,*) n. nres=ifn1(n). write(*,*)'n=>',nres. end. function ifn1(n). if (n .eq. 1) then. if
(還有42個字)
首頁
上一頁
1
下一頁
尾頁