作者satou20444 (希當普利斯)
看板Visual_Basic
標題[.NET] 費氏數列的問題Orz
時間Mon Mar 22 21:24:41 2010
請輸入專案類型(網站專案或者應用程式專案):應用程式專案
我照著之前版上那篇費氏數列的程式碼做了一次
但是每次都lebal1.text都只顯示一個數字,沒有辦法生出1、1、2… 這樣的排列
請問是哪邊錯了 Orz
Function fib(ByVal x As Integer)
If x = 0 Or x = 1 Then
Return 1
Else
Return fib(x - 1) + fib(x - 2)
End If
End Function
Private Sub Form1_Load
(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Dim i As Integer
Dim j As Integer = 5000
For i = 0 To j
Label1.Text = fib(i) & "、"
'If f(i) > 9527 Then
'Exit For
'End If
Next
End Sub
版本是 Visual Basic 2008
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.40.128.208
1F:→ satou20444:if那邊我關掉了,因為還用不到@@ 03/22 21:25
※ satou20444:轉錄至看板 ask 03/22 22:13
2F:→ mathlinka:Label1.Text &= fib(i) & "、" 03/22 22:45
3F:→ satou20444:收到,終於鬼打牆結束了-.- 03/22 22:56