📄 syx5_3.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "Command2"
Height = 615
Left = 2160
TabIndex = 1
Top = 1920
Width = 2175
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 615
Left = 120
TabIndex = 0
Top = 1920
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Dim a() As Integer, i%
Private Sub Command1_Click()
Dim s%
Randomize
ReDim a(1)
s = Int(Rnd * 90) + 10
a(1) = s
i = 1
Print a(1);
Do While s <> 99
s = Int(Rnd * 90) + 10
If s > a(i) Then
i = i + 1
ReDim Preserve a(i + 1)
a(i) = s
If i Mod 5 <> 0 Then
Print a(i);
Else
Print
End If
End If
Loop
Print
End Sub
Private Sub Command2_Click()
Dim j%, s%, b() As Integer, k%
Randomize
s = Int(Rnd * 90) + 10
Print s
ReDim b(i)
If i = 0 Then
Print "请产生随机数"
Else
ReDim Preserve a(i + 1)
For j = 1 To i
b(j) = a(j)
Print b(j);
Next j
End If
Print
For j = 1 To i
If s <= b(j) Then
For k = j + 1 To i + 1
a(k) = b(k - 1)
Next k
a(j) = s
End If
Exit For
Next j
If j > i + 1 Then
a(i + 1) = s
End If
For j = 1 To i + 1
Print a(j);
Next j
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -