删除一个数列中的重复数Option ExplicitOption Base 1Dim A() As Integer '定义了一个模块级的动态数组Private Sub Command1_Click() Dim N As Integer, I As Integer Text1 = "" Text2 = "" N = Inpu
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/09 05:12:44
删除一个数列中的重复数Option ExplicitOption Base 1Dim A() As Integer '定义了一个模块级的动态数组Private Sub Command1_Click() Dim N As Integer, I As Integer Text1 = "" Text2 = "" N = Inpu
删除一个数列中的重复数
Option Explicit
Option Base 1
Dim A() As Integer '定义了一个模块级的动态数组
Private Sub Command1_Click()
Dim N As Integer, I As Integer
Text1 = ""
Text2 = ""
N = InputBox("输入N")
ReDim A(N)
Randomize
For I = 1 To N
A(I) = Int(10 * Rnd) + 1
Text1 = Text1 & Str(A(I))
Next
End Sub
Private Sub CmdErase_Click()
Dim Ub As Integer, I As Integer, J As Integer
Dim K As Integer, N As Integer
Text2 = ""
Ub = UBound(A)
N = 1
Do While N < Ub
I = N + 1
Do While I
删除一个数列中的重复数Option ExplicitOption Base 1Dim A() As Integer '定义了一个模块级的动态数组Private Sub Command1_Click() Dim N As Integer, I As Integer Text1 = "" Text2 = "" N = Inpu
2个子程序中的n不相干,都是局部变量,退出各自的子程序后n都会清0