题型:综合题 题类:常考题 难易度:普通
浙江省高中信息技术 算法及VB语言表达基础同步练习
Private Sub Command1_Click()
Dim r As Integer, k1 As Integer, k2 As Integer
Dim s As String, n As Integer
‘从文本框TxtIn 中获取字符串
Randomize
r = Int(Rnd() * 10) + 1 ‘随机生成洗牌次数
n = Len(s)
Do While r >= 1 ‘洗牌操作
k1 = Int(Rnd() * (n - 2)) + 2
k2 = Int(Rnd() * (n - k1 + 1)) + k1
s = + Mid(s, 1, k1 - 1) + Mid(s, k2 + 1, n - k2)
r = r - 1
Loop
= s ‘输出结果
End Sub
试题篮