内容发布更新时间 : 2024/12/23 9:56:37星期一 下面是文章的全部内容请认真阅读。
ClientWidth = 6240 LinkTopic = \ ScaleHeight = 4320 ScaleWidth = 6240
StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Command1 Caption = \ Height = 495 Left = 4440 TabIndex = 0 Top = 3360 Width = 1215 End End
Attribute VB_Name = \
Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click()
Dim a(1 To 10) As Integer, i%, j% For i = 1 To 10
a(i) = Int(Rnd * 50 + 1) Print a(i); Next i Print n = 10
For i = 1 To n - 1
For j = n To i + 1 Step -1 If a(j) > a(j - 1) Then
t = a(j): a(j) = a(j - 1): a(j - 1) = t End If Next j Next i
Print \排序之后--------\ For i = 1 To 10 Print a(i); Next i Print End Sub
VERSION 5.00
Begin VB.Form Form1
Caption = \
ClientHeight = 4200 ClientLeft = 60 ClientTop = 450 ClientWidth = 7635 LinkTopic = \ ScaleHeight = 4200 ScaleWidth = 7635
StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Command2 Caption = \方法2\ Height = 495 Left = 5640 TabIndex = 1 Top = 2520 Width = 1215 End
Begin VB.CommandButton Command1 Caption = \方法1\ Height = 495 Left = 5640 TabIndex = 0 Top = 840 Width = 1215 End End
Attribute VB_Name = \
Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click() Dim a(1 To 20) As Integer, i% For i = 1 To 20
a(i) = Int(Rnd * 101 + 1) 'Print a(i);
'If i Mod 5 = 0 Then Print
If i Mod 5 = 0 Then Print a(i) Else Print a(i); Next i Print End Sub
Private Sub Command2_Click() Dim a(1 To 20) As Integer, i% For i = 1 To 20
a(i) = Int(Rnd * 101 + 1) Print a(i);
If i Mod 5 = 0 Then Print Next i
End Sub
VERSION 5.00
Begin VB.Form Form1
Caption = \ ClientHeight = 4440 ClientLeft = 60 ClientTop = 450 ClientWidth = 6480 LinkTopic = \ ScaleHeight = 4440 ScaleWidth = 6480
StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Command1 Caption = \ Height = 495 Left = 4680 TabIndex = 0 Top = 3120 Width = 1215 End End
Attribute VB_Name = \
Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click()
Dim a%(1 To 9), b(1 To 3, 1 To 3) As Integer, i%, j% For i = 1 To 9
a(i) = Int(Rnd * 100) Print a(i); Next i Print
For i = 1 To 3 For j = 1 To 3
b(i, j) = a((i - 1) * 3 + j) Next j Print
Next i
For i = 1 To 3 For j = 1 To 3 Print b(i, j); Next j Print Next i
End Sub
VERSION 5.00
Begin VB.Form Form1
Caption = \ ClientHeight = 4080 ClientLeft = 60 ClientTop = 450 ClientWidth = 6225 LinkTopic = \ ScaleHeight = 4080 ScaleWidth = 6225
StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Command1 Caption = \ Height = 495 Left = 4800 TabIndex = 0 Top = 3360 Width = 1215 End End
Attribute VB_Name = \
Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click() Dim a() As Integer, i% n = InputBox(\
ReDim a(1 To n, 1 To n) For i = 1 To n For j = 1 To n
a(i, j) = Int(Rnd * 100) Print a(i, j); Next j
Print Next i End Sub
VERSION 5.00
Begin VB.Form Form1
Caption = \ ClientHeight = 4395 ClientLeft = 60 ClientTop = 450 ClientWidth = 7230 LinkTopic = \ ScaleHeight = 4395 ScaleWidth = 7230
StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Command1 Caption = \ Height = 495 Left = 5160 TabIndex = 0 Top = 3240 Width = 1215 End End
Attribute VB_Name = \
Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click() Dim a() As Integer, i% n = InputBox(\
ReDim a(1 To n, 1 To n) For i = 1 To n
For j = 1 To n
If (i = j) Or (i + j = n + 1) Then a(i, j) = 1 Else a(i, j) = 0
Print a(i, j); Next j Print Next i End Sub
VERSION 5.00
Begin VB.Form Form1
Caption = \