admin 管理员组文章数量: 887021
高中计算机在线使用方法,高中
(2)
实现上述功能的VB程序如下,请在划线处填入合适的代码。
Dim n As Integer, t As Integer, m As Integer, I As Integer, j As
Integer
Dim ans As Integer, u As Integer, st As Integer, p As Long
Dim a(21) As Integer, b(11) As Integer, f(11) As Integer
Dim c(11)As Integer '用于存储构成一笔画各边的序号
Dim s As String, ss As String
Private Sub Command1_Click()
n= Val(Text1.Text)
s= Text2.Text: t= 0
For j= 1 To Len(s)
ch =
Mid(s, j, 1)
If ch
= "," Then
b(a(t))
= b(a(t)+1
t=t+1
a(t)=
0
Else
a(t)=
a(t)*10 + Val(ch)
End
If
Next j
________: m=t\2: ans=0
st= 1
For i= 1 To n
If b(i) Mod 2=1 Then
ans = ans+ 1: st=i
Next i
If ans=0 Or ans=2 Then
For p=1 To m^m '穷举边的顺序
If try(p) Then
u= st: ss =
Str(u)
For j=1 To m
If (a(c(j)* 2)<>u) And (a(c(j)*2-1)<>u)
Then Exit For
If________
Then u= a(c(j)*2- 1) Else u=a(c(j)*2)
ss=ss
+"->"+ Str(u)
Next j
If j> m
Then Exit For
End If
Next p
Else
ss="无法一笔画!"
End If
Label3.Caption=ss
End Sub
Function try(x As Long) As Boolean '生成边的访问顺序,并判断有无重复的边
Dim k As Integer, y As
Long
y=x
For k=1 To m
c(k)=y Mod m+1: y-y\m
If f(c(k)) = x Then
Exit For
________
Next k
If k> m Then try=True
Else try = False
End Function
本文标签: 高中计算机在线使用方法 高中
版权声明:本文标题:高中计算机在线使用方法,高中 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1687782646h140835.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论