用vb.net编程汉诺塔,c语言汉诺塔编程
VB 程序设计 (汉诺塔问题)
给你个参考:
创新互联专注于企业成都全网营销推广、网站重做改版、德令哈网站定制设计、自适应品牌网站建设、H5网站设计、电子商务商城网站建设、集团公司官网建设、外贸营销网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为德令哈等各大城市提供网站开发制作服务。
Private Sub hanoi(n As Integer, one As String, two As String, three As String)
If n = 1 Then
Print Tab(5); one; "-------"; three
Else
Call hanoi(n - 1, one, three, two)
Print Tab(5); one; "-------"; three
Call hanoi(n - 1, two, one, three)
End If
End Sub
Private Sub Form_Click()
Dim x As Integer
x = Val(InputBox("请输入圆盘的个数"))
Print Tab(5); "将" x "个圆盘从A柱移到C柱的移动顺序为"
Call hanoi(x, "A", "B", "C")
End Sub
汉罗塔游戏VB程序怎么写
Dim N As Integer
Private Sub Form_Click()
Dim N As Integer
N = Val(InputBox("请输入汉诺塔的圆盘总数:"))
Call MoveDisk(N, "A", "B", "C")
End Sub
Sub MoveDisk(N, A As String, B As String, C As String)
If N = 1 Then
Print "将第1个圆盘从第" A "根柱子移到第" C "根柱子"
Else
Call MoveDisk(N - 1, A, C, B)
Print "将第" N "个圆盘从第" A "根柱子移到第" C "根柱子"
Call MoveDisk(N - 1, B, A, C)
End If
End Sub
这个是文字型的,你自己转换成图片的吧
vb编程:汉诺塔
这个程序难度不小,估计是个课程设计或是毕业设计之类的,我建议你还是自己先动手做,当遇到问题再提出来大家帮忙。不是一个人一两天能做出来的,只要开始去做,好的开始是成功的一半。
vb汉诺塔
private function Hnt(n as integer,A,as string,B as string,C as string)
Hnt (n-1),a,c,b
是上面的函数的四个参数呀,这是在函数中再次调用本函数
本文名称:用vb.net编程汉诺塔,c语言汉诺塔编程
文章路径:http://scyanting.com/article/hsoise.html