早教吧 育儿知识 作业答案 考试题库 百科 知识分享

删除一个数列中的重复数OptionExplicitOptionBase1DimA()AsInteger'定义了一个模块级的动态数组PrivateSubCommand1Click()DimNAsInteger,IAsIntegerText1=""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
▼优质解答
答案和解析
2个子程序中的n不相干,都是局部变量,退出各自的子程序后n都会清0