用VB编写的汉诺塔程序

时间:2013-11-03 18:09:25
【文件属性】:

文件名称:用VB编写的汉诺塔程序

文件大小:11KB

文件格式:RAR

更新时间:2013-11-03 18:09:25

vb 汉诺塔

用VB编写的简单汉诺塔程序 Private Sub cmdStart_Click() n = Int(Text1.Text) ReDim Data(1 To n, 1 To 3) For i = 1 To n For j = 1 To 3 Data(i, j) = 0 Next j Next i For i = 1 To n Data(i, 1) = i Next i ColNow = 1 SelNum = 0 Call ShowPic End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyUp If SelNum = 0 Then SelNum = Data(1, ColNow): Call Pop Case vbKeyDown If SelNum <> 0 Then If Push = True Then SelNum = 0 If Data(n, 3) = n Then Call ShowPic: MsgBox "恭喜你通过!", vbOKOnly, "Pass" End If Case vbKeyLeft ColNow = ColNow - 1 If ColNow < 1 Then ColNow = 1 Case vbKeyRight ColNow = ColNow + 1 If ColNow > 3 Then ColNow = 3 End Select Call ShowPic End Sub


【文件预览】:
汉诺塔
----Form1.frm(5KB)
----工程1.vbp(819B)
----Form1.frx(8KB)
----hanuo.ico(7KB)
----工程1.vbw(50B)
----汉诺塔.exe(40KB)

网友评论