题型:综合题 题类:常考题 难易度:普通
浙江省高中信息技术——VB基础知识
Private Sub Cmd_Click( )
Dim i As Integer, j As Integer, k As Integer
Dim As Single, yl As Single,x2 As Single, y2 As Single
Dim As Single, Totald As Single, v As Single, s As String
s= ①
x1=0:y1=0 ‘出发点为坐标原点
k=1:j=1: Totald=0
For i=1 To Len(s)
If Mid(s, i, 1) =”,” Then
v=Val(mid(s,j,i-j)) ‘提取坐标值,保存在变量v中
j=1+1
If ② Then
x2=v
Else
y2=v
d=Sqr((x2-x1)^2+(y2-y1)^2)
Totald=Totald+d
x1=x2:y1=y2
End If
k=k+1
End If
Next i
Label1.Caption=Str(Totald)
End Sub
① ②
试题篮