
Dim a (1 To 13) As Integer, n As Integer
Private Sub Command1_Click()
Dim i As Integer, s As String, j As Integer
Randomize
n=13
For i=1 To n
a(i)=Int(Rnd*13)+1
Next iFor i=1 To n-1
For j=i+1 To n
If a(j) < a(i) Then
t=a(j): ①____: a(i)=t
End If
Next j
Next is=""
For i=1 To n
s=s+Str(a(i))
If ②___ Then s=s+ ","
Next i
Label1.Caption=s
End Sub
Private Sub Command2_Click()
Dim i As Integer, j As Integer, t As Integer, k As Integer
Dim max As Integer '存储连续数个数最大值
Dim begin As Integer '存储连续数开始的数值
k=1
max=1
For i=2 To 13
If a(i)=a(i-1)+1 Or a(i)=a(i-1) Then
If ③____ Then k=k+1
If k > max Then
max=k
begin= ④____
End If
Else
k=1
End If
Next i
s=""
For j=begin To begin+max-1
s=s+Str(j)
Next j
Label2.Caption=s
End Sub

同类型试题

y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2


y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2

