7VB上机答案

合集下载

Vb上机实验答案

Vb上机实验答案

第一题1.制作如图所示窗体界面。

(用真实的姓名、班级及学号)2.使时间每隔1秒刷新一次3.单击“最大值”命令按钮时,算出通过键盘输入的5个数的最大值4.在列表框中输入20、22、24、26、28Private Sub Command1_Click()Dim a(1 To 5) As IntegerFor i = 1 To 5a(i) = InputBox("please input a number")Next immax = a(1)For i = 1 To 5If a(i) > mmax Thenmmax = a(i)End IfNext iMsgBox mmaxEnd SubPrivate Sub Timer1_Timer()Label2.Caption = TimeEnd Sub第二题1.两个文本框里输入两个数字从而确定一个范围。

2.单击“计算”按钮求出这个范围中能被3或5整除的数的平方和,结果显示在label3中。

bel3的背景色每隔1.5秒蓝红交替。

Private Sub Command1_Click()Dim a As IntegerDim b As Integera = Text1.Textb = Text2.Texts = 0For i = a To bIf a Mod 3 = 0 Or b Mod 5 = 0 ThenLabel3.Caption = Label3.Caption & i & ","s = s + i * iEnd IfNext iLabel3.Caption = sEnd SubPrivate Sub Timer1_Timer()If Label3.BackColor = vbRed ThenLabel3.BackColor = vbBlueElseLabel3.BackColor = vbRedEnd IfEnd Sub第三题1、单击按钮,在文本框中显示1到终值的所有整数的平方和2、单击生成列表按钮,在列表框中显示1到终值之间的所有整数Private Sub Command1_Click()Dim a As Integera = Text1.Texts = oFor i = 1 To as = s + i * iNext iText2.Text = sEnd SubPrivate Sub Command2_Click()Dim a As Integera = Text1.TextFor i = 1 To aList1.AddItem iNext iEnd Sub第四题1、“大家好”的背景颜色红蓝黄交替,单击“停止”按钮时停止颜色变化2、在文本框中写入任意数字,单击“生成列表”按钮,将1到文本框中输入数字之间所有能被3整除得数在列表框中显示Private Sub Command1_Click()Timer1.Enabled = TrueEnd SubPrivate Sub Command2_Click()Timer1.Enabled = FalseEnd SubPrivate Sub Command3_Click()Dim a As Integera = Text1.TextFor i = 1 To aIf i Mod 3 = 0 ThenList1.AddItem iEnd IfNext iEnd SubPrivate Sub Timer1_Timer()If Label1.ForeColor = vbRed ThenLabel1.ForeColor = vbBlueElseIf Label1.ForeColor = vbBlue ThenLabel1.ForeColor = vbY ellowElse: Label1.ForeColor = vbRedEnd IfEnd Sub第五题1、“大家好”电子滚动平当单击按钮“开始”时从左向右滚动,当滚动到屏幕最右端的时候,从新回到最左端开始滚动;单击“停止”按钮时停止滚动2、在文本框中写入任意内容,单击“添加”按钮可以将文本框中的内容加入到列表框中Private Sub Command1_Click()Timer1.Enabled = TrueEnd SubPrivate Sub Command2_Click()Timer1.Enabled = FalseEnd SubPrivate Sub Command3_Click()List1.AddItem Text1.TextEnd SubPrivate Sub Timer1_Timer()Label1.Left = Label1.Left + 100If Label1.Left > Form1.Width - Label1.Width ThenLabel1.Left = 0End IfEnd Sub第六题1、标签中写入“大家好”,每秒钟“大家好”和“哈哈”交替出现(即,第一秒出现“大家好”。

vb上机考试习题以及答案

vb上机考试习题以及答案

VB上机考试1、利用随机函数产生25个100到999之间的整数,构成5?5的矩阵,输出该矩阵。

Dim a(1 To 5, 1 To 5)Private Sub Form_Click()RandomizeFor i = 1 To 5For j = 1 To 5a(i, j) = Int(Rnd * (999 - 100 + 1) + 100)Print a(i, j);Next jPrintNext iEnd Sub2、利用随机函数产生25个10到99之间的整数,求其平均值(要求保留3位小数,第4位四舍五入)。

Private Sub Form_Click()For i = 1 To 25a = Int(Rnd * (99 - 10 + 1) + 10)Print a;s = s + aNext iPrintAvg = s / 25Print AvgEnd Sub3、在窗体上按下鼠标的右键,记录其坐标。

Private Sub Form_Load()= 1= 2End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)If Button = 2 Then= X & "," & YEnd IfEnd Sub4、利用随机函数产生25个10到99之间的整数,按从小到大的顺序显示。

Dim a(1 To 25)Private Sub Form_Click()ClsFor i = 1 To 25a(i) = Int(Rnd * (99 - 10 + 1) + 10)Print a(i);Next iPrintFor i = 1 To 25 - 1For j = 1 To 25 - iIf a(j) > a(j + 1) Then tmp = a(j): a(j) = a(j + 1): a(j + 1) = tmp Next jNext iFor i = 1 To 25Print a(i);Next iEnd Sub5、利用随机函数产生50个 [1,6] 之间的整数, 分别统计出1的个数,2的个数,3的个数,4的个数,5的个数和6的个数。

vb上机试题及答案

vb上机试题及答案

vb上机试题及答案一、选择题(每题2分,共10分)1. VB中,用来声明变量的关键字是:A. DimB. SetC. CallD. Function答案:A2. 下列哪个不是VB中的控件事件?A. ClickB. LoadC. PrintD. Resize答案:C3. VB中,用于循环结构的关键字是:A. ForB. NextC. LoopD. Do答案:A4. VB中,用于定义过程的关键字是:A. SubB. FunctionC. DimD. Call答案:A5. VB中,用于定义窗体的关键字是:A. FormB. ClassC. ModuleD. Property答案:A二、填空题(每题2分,共10分)1. VB中,使用________关键字可以定义一个数组。

答案:Dim2. 在VB中,________函数用于将字符串转换为大写。

答案:UCase3. VB中的________函数用于计算字符串的长度。

答案:Len4. 使用________语句可以退出当前循环。

答案:Exit For5. VB中,________语句用于创建一个子程序。

答案:Sub三、简答题(每题5分,共15分)1. 请简述VB中如何声明一个变量,并赋值。

答案:在VB中,使用Dim关键字声明变量,例如Dim myVar As Integer,然后使用赋值语句赋值,例如myVar = 10。

2. 解释VB中什么是事件驱动编程。

答案:事件驱动编程是一种编程范式,程序的执行流程由外部事件触发,而不是由程序的顺序执行决定。

在VB中,用户操作(如点击按钮)会触发事件,程序响应这些事件执行相应的代码。

3. 描述VB中如何使用条件语句。

答案:在VB中,使用If...Then...Else语句来实现条件判断。

例如,If condition Then '执行代码块 1 Else '执行代码块 2 End If。

四、编程题(每题15分,共30分)1. 编写一个VB程序,计算并输出1到100之间所有偶数的和。

VB教材课后习题答案

VB教材课后习题答案

<大学程序设计基础-Visual Basic>教材课后习题答案第1章一、选择题1 2 3 4 5 6 7B D BC B B D第2章一、选择题1 2 3 4 5 6 7 8 9 10B C B C B C A A A A11 12 13 14A B A A二、填空题1.rem或’ _ :2.“” # #3.5x2-3x-2sinA/34.3214565.300三、操作题1、程序段:Private Sub Command1_Click()Dim x As Integer, y As IntegerDim s As Long, c As Longx = Text1.Texty = Text2.Texts = x * yc = (x + y) * 2Label3.Caption = "长方形的面积为" + Str(s)Label4.Caption = "长方形的周长为" + Str(c)End Sub3、程序段:Private Sub Command1_Click()Text1.Text = "第一"End SubPrivate Sub Command2_Click()Text1.Text = "第二"End Sub4、程序代码:Private Sub Text1_Change()Text1.MaxLength = 10End Sub5、程序代码:Private Sub Text1_Click()Text1.SelStart = 0Text1.SelLength = Len(Text1.Text)End Sub第3章一、选择题1 2 3 4 5 6 7D A D B A D B二、填空题1. False2.B^2-4*a*c else三、操作题1.从键盘输入三个值,判断它们能否构成三角形的三个边。

如果能构成一个三角形,则计算三角形的面积。

VB期末考试上机题编程答案

VB期末考试上机题编程答案

VB期末考试上机题编程答案1.新建一个工程,编写一个找出所有四位幸运数显示在列表框中,并将幸运数的个数显示在文本框中。

所谓幸运数是指凡前两位数字之和等于后两位数字之和的四位数。

将原窗体文件和工程文件分别另存为为f.frm和p.vbp,保存在D盘的VBTest文件夹中。

如不按要求保存,造成文件无法上传,后果自负!具体要求:1、程序参考界面如图所示,编程时不得增加或减少界面对象或改变对象的种类,窗体及界面元素大小适中,且均可见;2、单击"查找"按钮,则开始查找并在列表框中显示结果,并在文本框中显示幸运数的个数;3、单击“清除”按钮,则将列表框和文本框清空;4、单击“退出”按钮,结束程序运行;5、程序中应包含一个过程,用于判断一个数是否是幸运数。

解:Private Sub Command1_Click()Dim i As Integer, a As IntegerFor i = 1000 To 9999If k(i) Then List1.AddItem i: a = a + 1Next iText1.Text = aEnd SubPrivate Sub Command2_Click()List1.ClearText1.Text = ""End SubPrivate Sub Command3_Click()EndEnd SubPrivate Function k(n As Integer) As IntegerDim i As Integer, a As Integer, s1 As Integer, s2 As IntegerDim s As Strings = CStr(n)For i = 1 To Len(s) / 2s1 = s1 + Mid(s, i, 1)s2 = s2 + Mid(s, Len(s) + 1 - i, 1)Next iIf s1 = s2 Then k = TrueEnd Function2. 新建一个工程,编写求某一自然数因子和的程序。

全国计算机VB上机题库及答案(全)

全国计算机VB上机题库及答案(全)

全国计算机等级考试二级VB上机考试新版题库及解析【2013年3月考试专用】考前复习必看资料:PiaoMo整理—1—第一套上机题题干166一、基本操作题请根据以下各小题的要求设计Visual Basic 应用程序(包括界面和代码)。

(1)在名称为Form1的窗体上建立一个名称为Command1的命令按钮数组,含三个命令按钮,它们的Index 属性分别为0、1、2,标题依次为"是"、"否"、"取消",每个按钮的高、宽均为300、800。

窗体的标题为"按钮窗口"。

运行后的窗体如图1所示。

注意:存盘时必须存放在考生文件夹下,工程文件名为sjt1.vbp ,窗体文件名为sjt1.frm 。

图1【操作步骤】步骤1:新建一个"标准EXE"工程,如表1在窗体中用"复制"和"粘贴"画出控件数组并设置属性。

表1(2)在名称为Form1的窗体上画一个名称为Sha1的形状控件,然后建立一个菜单,标题为"形状",名称为shape0,该菜单有两个子菜单,其标题分别为"正方形"和"圆形",其名称分别为shape1和shape2,如图2所示,然后编写适当的程序。

程序运行后,如果选择"正方形"菜单项,则形状控件显示为正方形;如果选择"圆形"菜单项,则窗体上的形状控件显示为圆形。

注意:程序中不能使用变量,每个事件过程中只能写一条语句。

保存时必须存放在考生文件夹下,工程文件名为sjt2.vbp ,窗体文件名为sjt2.frm 。

图2【操作步骤】步骤1:新建一个"标准EXE"工程,在窗体Form1中画一个名为Sha1的形状控件。

步骤2:选择【工具】→【菜单编辑器】命令,打开菜单设计器,如表2中的设置建立菜单项。

VB语言程序设计课后编程及上机调试参考答案

VB语言程序设计课后编程及上机调试参考答案

V B语言程序设计课后编程及上机调试参考答案ex0101Private Sub Label1_Click()Caption = "练习"= "确定"= True= True= "Visual Basic程序设计教程"End Subex0102Private Sub Command1_Click()= "我有电脑"End SubPrivate Sub Command2_Click()= "我没有电脑"End SubPrivate Sub Command3_Click()= "" '一对双撇号,中间不留空End Subex0104Private Sub Command1_Click()Dim x As Singlex = Val= 15 * xEnd Subex0202Private Sub Form_Click()Dim r As Single, s As Singler =s = * r ^ 2= "圆的面积为" & sEnd Subex0204Private Sub Command1_Click() '"最大化"按钮= 2 '最大化End SubPrivate Sub Command2_Click() '"还原"按钮= 0 '还原Private Sub Command3_Click() '"最小化"按钮= 1 '最小化End Subex0205Private Sub command1_click()Dim x As SingleDim y As Singlex = Valy = Val= x * x + y * yEnd Subex0206Private Sub command1_click()Dim x As Stringx == Left(x, 1) + Right(x, 1)End Subex0301Private Sub Form_Load()Dim x As Integer, y As IntegerDim a As Integer, b As Integer, c As Integerx = Val(InputBox("请输入一个三位数"))a = Int(x / 100) '求百位数b = Int(x / 10) - a * 10 '求十位数c = x Mod 10 '求个位数 Showy = c * 100 + b * 10 + a '生成倒序数 Print x; "倒序数为:"; y '显示倒序数End Subex0302Private Sub Command1_Click()n = ValRandomizex = Int(1 + n * Rnd)= "第一个随机数" + Str(x)x = Int(1 + n * Rnd)= "第二个随机数" + Str(x)x = Int(1 + n * Rnd)= "第三个随机数" + Str(x)ex0303Private Sub Cmd1_Click()= True= "您已下达显示命令"End SubPrivate Sub Form_Click()= TrueEnd Subex0304Private Sub Form_KeyPress(KeyAscii As Integer)ShowPrint "输入字符:"; Chr(KeyAscii), "ASCII码为;"; KeyAsciiEnd SubPrivate Sub Form_DblClick()ClsEnd Subex0305Private Sub Form_Load()x = MsgBox("在这里显示提示信息", 4 + 0, "请确认")x = MsgBox("在这里显示" + Chr(13) + "提示信息", 3 + 0, "请确认")x = MsgBox("在这里显示" + Chr(13) + "提示信息", 2 + 16 + 0, "请确认") End Subex0401Private Sub Form_Load()Dim x As Long, s As Stringx = InputBox("输入一个整数(1~35000)")s = "奇数"If x Mod 2 = 0 Then s = "偶数"MsgBox sEnd Subex0402Private Sub Command1_Click()Dim a As Single, b As SingleDim c As Single, d As SingleDim m As Single, n As Single, x As SingleShowa = Valb = Valc = Vald = ValIf a > b Then '求a、b中的较大数 m = aElsem = bEnd IfIf c > d Then '求c、d中的较大数 n = cElsen = dEnd IfIf m > n Then '求m、n中的较大数 x = mElsex = nEnd If= xEnd Subex0403Private Sub Command1_Click()Dim t As String, p As Stringt = Mid, 5, 1)Select Case tCase "2"p = "博士生"Case "3"p = "硕士生"Case "4"p = "本科生"Case "5"p = "专科生"Case Elsep = "无效学号"End Select= Left, 2) + "级"= pEnd Subex0404Private Sub Command1_Click()r = 0: g = 0: b = 0If = 1 Thenr = 255End IfIf = 1 Theng = 255End IfIf = 1 Thenb = 255End If= RGB(r, g, b)End SubPrivate Sub Command2_Click()EndEnd Subex0405Private Sub Form_Load()= "0"= 1= 1= 22= "黑体"= 1000End SubPrivate Sub TimClk_Timer()= Val + 1End Subex0406Private Sub Form_Load()= False= FalseEnd SubPrivate Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If > 0 Then= TrueEnd IfEnd SubPrivate Sub Command1_Click()= True= TrueEnd SubPrivate Sub Command2_Click()== False= FalseEnd Subex0501Private Sub Form_Load()Dim k As Integer, s As Integer, t As Integer s = 0For k = 1 To 100 Step 2s = s + kNext kShowPrint "1~100范围内的奇数和:"; sEnd Subex0502Private Sub Form_Load()Dim s As SingleShows = 0For k = 1 To 200s = s + k / (1 + k * k)Next kPrint Int(s * 10 + / 10End Subex0503Private Sub Form_Load()Showk = 2s = 0Do While k < 101s = s + k * (k - 1)k = k + 2LoopPrint sEnd Subex0504Private Sub Form_Load()Dim k As Integer, a As Integer, b As Integer Dim c As Integer, n As IntegerShown = 0Print "三位数的水仙花数是:"For k = 100 To 999a = Int(k / 100)b = Int((k - 100 * a) / 10)c = k Mod 10If a * a * a + b * b * b + c * c * c = k Then Print kn = n + 1End IfNext kPrint "一共有" & n & "个水仙花数"End Subex0505Private Sub Form_Load()ShowFor k = 1000 To 9999If k Mod 78 = 0 Thena = Int(k / 1000)b = Int(k / 100) - 10 * ac = Int(k / 10) - 100 * a - 10 * bd = k Mod 10If a = b And c = d ThenPrint kEnd IfEnd IfNext kEnd Subex0506Private Sub Command1_Click()Dim s As String, y As StringDim x As String, t As Strings = : y = ""For k = 1 To Len(s)x = Mid(s, k, 1)t = UCase(x)If t >= "A" And t <= "Z" Theny = y + xEnd IfNext k= yEnd Subex0507Private Sub Command1_click() '"显示"按钮单击事件FontSize = 12ClsFor i = 0 To - 1 '逐项判断If (i) Then '真时为选定Print (i)End IfNext iEnd Subex0508Private Sub Form_Load()ShowFor a = 1 To 9For b = 1 To 9For c = 1 To 9For d = 1 To 9x = a * 1000 + b * 100 + c * 10 + dy = b * 1000 + a * 100 + a * 10 + cz = d * 100 + d * 10 + aIf x - y = z ThenPrint "A=" & a & ",B=" & b & ",C=" & c & ",D=" & d End IfNext dNext cNext bNext aEnd Subex0601Private Sub Command1_Click()Dim a(10) As Integer, min As Integer, pos As IntegerRandomizeFor i = 1 To 10a(i) = Int(Rnd * 90 + 10)Print a(i);Next iPrintmin = a(1)pos = 1For k = 2 To 10If a(k) < min Thenmin = a(k)pos = kEnd IfNext kPrint "最小数:"; min, "位置:"; posEnd Subex0602Private Sub Form_Load()Dim a As Variant, b As VariantDim c(8) As Integera = Array(3, 4, 2, 1, 5, 7, 8, 11, 13)b = Array(10, 6, 12, 9, 13, 8, 8, 1, 16)For k = 0 To 8c(k) = a(k) + b(k)Next kShowFor k = 0 To 8Print c(k)Next kEnd Subex0603Private Sub Form_Load()Dim d() As IntegerDim k As Integer, t As Integer, m As Integer Dim h As Integer, n As Integern = Val(InputBox("请输入数组个数n:"))ReDim d(n)ShowPrint "处理前数据 :"RandomizeFor k = 1 To nd(k) = Int((101 * Rnd - 50))Print d(k);Next kPrintm = Int(n / 2)For k = 1 To mh = n - k + 1t = d(h): d(h) = d(k): d(k) = tNext kPrint "处理的结果 :"For k = 1 To nPrint d(k);Next kEnd Subex0604Private Sub Form_Load()Dim a(8, 8) As Integer, n As IntegerDim s As Long, i As Integer, j As IntegerShowRandomizen = 8For i = 1 To nFor j = 1 To nx = Int(90 * Rnd + 10) '产生一个随机数 a(i, j) = xNext jNext is = 0For i = 1 To nFor j = 1 To ns = s + a(i, j)Next jNext iPrint "所有元素之和;"; sPrintFor i = 1 To ns = 0For j = 1 To ns = s + a(i, j)Next jPrint "第"; i; "行元素之和;"; sNext iPrints = 0For i = 1 To ns = s + a(i, i)Next iPrint "主对角线元素之和;"; sPrints = 0For i = 1 To nFor j = 1 To nIf i = 1 Or i = n Or j = 1 Or j = n Thens = s + a(i, j)End IfNext jNext iPrint "所有靠边元素之和;"; sEnd Subex0605Option Base 1Private Sub Form_Load()Dim a(8, 8) As Integer, n As IntegerDim max As Integer, r As Integer, c As IntegerShowRandomizen = 8For i = 1 To nFor j = 1 To nx = Int(900 * Rnd + 100) '产生一个随机数 a(i, j) = xPrint x;Next jPrintNext imax = 0: r = 1: c = 1PrintFor i = 1 To nFor j = 1 To nIf a(i, j) > max Then '判断有无更大数 max = a(i, j): r = i: c = jEnd IfNext j, iPrint "最大值为:"; maxPrint "位于行:"; r, "列:"; cEnd Subex0606Dim n As IntegerPrivate Sub Cmd1_Click()n = n + 1If n = 3 Then n = 0Opt1(n).Value = TrueEnd SubPrivate Sub Form_Load()End Subex0607Private Sub Form_Load()Dim a(20) As IntegerRandomizea(1) = Int(10 + 90 * Rnd) k = 1Do While k < 20x = Int(10 + 90 * Rnd) f = 0For j = 1 To kIf x = a(j) Then f = 1Exit ForEnd IfNext jIf f = 0 Thenk = k + 1a(k) = xEnd IfLoopShowFor j = 1 To 20Print a(j)Next jEnd Subex0701Private Sub Form_Click()Dim s As Longs = 0For k = 1 To 10s = s + jc(k)Next kPrint sEnd SubFunction jc(n) As LongDim t As Longt = 1For k = 1 To nt = t * kNext kEnd Functionex0702Private Sub Form_Load()Dim a As Single, b As Single, c As SingleDim d As Single, m As Single, n As SingleShowa = Val(InputBox("输入第1个数"))b = Val(InputBox("输入第2个数"))c = Val(InputBox("输入第3个数"))d = Val(InputBox("输入第4个数"))m = max(a, b) '求a、b中的较大数 n = max(c, d) '求c、d中的较大数 Print "最大数为:" & max(m, n) '求m、n中的较大数End SubFunction max(x, y) As SingleIf x > y Thenmax = xElsemax = yEnd IfEnd Functionex0703Private Sub Command1_Click()Dim d(5) As Single, m As SingleFor k = 0 To 5d(k) = Val(Text1(k).Text)Next kCall Max(d(0), d(1), d(2), m)Call Max(m, d(3), d(4), m)Call Max(m, m, d(5), m)= mEnd Subex0704Private Sub Form_Load()Dim x As LongShowx = Val(InputBox("输入一个数"))Print x; "的位数为:"; fnws(x)End SubFunction fnws(x As Long) As IntegerDim n As Integern = 1Do While x \ 10 > 0n = n + 1x = x \ 10Loopfnws = nEnd Functionex0705Private Sub C1_Click()End Subex0705APrivate Sub C2_Click()End Subex0706Dim n As IntegerPrivate Sub Command1_Click()usern = Trimpassw = TrimIf usern = "username" And passw = "password" ThenElsen = n + 1If n = 3 ThenEnd IfEnd If= ""= ""End Subex0706APrivate Sub Command1_Click()End Subex0906BPrivate Sub Command1_Click()Unload Form1Unload Form2Unload Form3EndEnd Subex0802Private Sub Form_Load()Dim i As Integer, j As IntegerShowFor i = 1 To 12Print String(20 - i, 32); '输出当前行左边的空格,分号表示下一输出项紧接输出 For j = 1 To 2 * i - 1 '输出2*i-1个字符If j <= i Then '按左、右两边指定输出字符k = j '左边输出的字符Elsek = 2 * i - j '右边输出的字符End IfIf k > 9 Then k = k + 7 '字母的ASCII码比数字大7Print Chr(k + 48); '以字符格式输出Next jPrint '换行Next iEnd Subex0803Dim t As Single, f As IntegerPrivate Sub Command1_Click() '“产生原稿文”按钮Randomizes = ""For k = 1 To 30x = Chr(Int(Rnd * 26) + 97) '随机产生小写字母s = s + xNext k= s '显示在文本框中= ""= False '允许录入'设置焦点= ""= ""f = 0 '第1次按键标记,0表示未按键End SubPrivate Sub Command2_Click() '“结束”按钮EndEnd SubPrivate Sub Text2_KeyUp(KeyCode As Integer, Shift As Integer)Dim c As Integer, k As IntegerIf f = 0 Then '第1次按键时,开始计时t = Timer '用t保存第1次按键的时间 f = 1 '1表示已按键和进入录入过程 End IfIf Len < 30 Then= Round(Timer - t, 1) & "秒" '显示用户当前所用时间Elsec = 0For k = 1 To 30 '统计录入正确的字母个数If Mid, k, 1) = Mid, k, 1) Thenc = c + 1End IfNext k= True '禁止录入= Round(c / 30 * 100, 2) & "%" '显示准确率End IfEnd Subex0901Private Sub Command1_Click()Open "静夜思.txt" For Input As #1Do While Not EOF(1) '文件未结束时,循环Input #1, xxLoopClose #1End Subex0902Dim d(1 To 20) As IntegerPrivate Sub Command1_Click() '"产生随机数"For i = 1 To 20d(i) = Int(1 + 99 * Rnd)d(i)Next iEnd SubPrivate Sub Command2_Click() '"保存"Open "" For Output As #1For i = 1 To 20Write #1, d(i)Next iClose #1End SubPrivate Sub Command3_Click() '"读出"Open "" For Input As #1Do While Not EOF(1)Input #1, xxLoopClose #1End SubPrivate Sub Command4_Click() '"结束"EndEnd Subex0903Private Sub Form_Load()ShowFor k = 1 To 6fn = "..\第7章\ex070" & k & ".vbp"If Dir(fn) = "" ThenPrint Mid(fn, 4) & "未编写!!"ElsePrint Mid(fn, 4) & "已编写!!"End IfNext kEnd Subex0904Private Sub Form_Load()chedir = "C:\Documents and Settings\Lin\My Documents\fsodir" If Dir(chedir, 16) = "" ThenMkDir chedirEnd Ifchefile = "C:\Windows\"If Dir(chefile) <> "" ThenFileCopy chefile, chedir & "\"End IfMsgBox "操作完毕!"End Subex1002Private Sub A1_Click()= vbRedEnd SubPrivate Sub A2_Click()= vbBlueEnd SubPrivate Sub A3_Click()= vbGreenEnd SubPrivate Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 ThenPopupMenu mun0End IfEnd Subex1003Private Sub Command1_Click()= "选择文件"= "文本文件|*.txt"= "C:\"=End SubPrivate Sub Command2_Click()Unload MeEndEnd Subex1101Private Sub calzc(x As Integer)= Round(2 * * x, 2)End SubPrivate Sub HV_Scroll()Dim r As Integerr == "=" & rCall calzc(r)End SubPrivate Sub Form_Load()= 300End Subex1102Private Sub Form_Load()For k = 0 To 3Image1(k).Stretch = TrueImage1(k).Picture = LoadPicture("箭头" & k + 1 & ".bmp") Next kEnd SubPrivate Sub Image1_Click(Index As Integer)= 20Select Case IndexCase 0"箭头向上"Case 1"箭头向左"Case 2"箭头向右"Case 3"箭头向下"End SelectEnd Sub。

VB语言程序设计课后编程及上机调试参考答案

VB语言程序设计课后编程及上机调试参考答案

V B 语言程序设计课后编程及上机调试参考答案ex0101Private Sub Label1_Click()Caption = " 练习 "Command1.Caption = " 确定 "Label1.FontBold = TrueLabel1.AutoSize = TrueLabel1.Caption = "Visual BasicEnd Sub ex0102Private Sub Command1_Click()Txt.Text = " 我有电脑 "End SubPrivate Sub Command2_Click()Txt.Text = " 我没有电脑 " EndSub程序设计教程Private Sub Command3_Click()Txt.Text = "" ' 一对双撇号,中间不留空 End Subex0104Private Sub Command1_Click()Dim x As Singlex = Val(Text1.Text)Text2.Text = 15 * xEnd Sub ex0202Private Sub Form_Click()Dim r As Single, s As Singler = 4.6s = 3.14159 * r A 2Text1.Text = " 圆的面积为 " & sEnd Subex0204Private Sub Command1_Click() '"Form1.WindowState = 2 ' End Sub最大化 " 按钮最大化Private Sub Command2_Click() '"Form1.WindowState = 0 '还原 "按钮还原End SubPrivate Sub Command3_Click() '"Form1.WindowState = 1 '最小化 " 按钮最小化End Sub ex0205Private Sub command1_click()Dim x As SingleDim y As Singlex = Val(Text1.Text)y = Val(Text2.Text)Text3.Text = x * x + y * y End Sub ex0206Private Sub command1_click()Dim x As Stringx = Text1.TextText2.Text = Left(x, 1) + Right(x, 1)End Sub ex0301 Private Sub Form_Load()Dim x As Integer, y As IntegerDim a As Integer, b As Integer, c As Integer x = Val(InputBox(" 请输入一个三位数 "))a = Int(x / 100) ' 求百位数b = Int(x / 10) - a * 10 ' 求十位数c = x Mod 10 ' 求个位数Showy = c * 100 + b * 10 + a ' 生成倒序数Print x; " 倒序数为: "; y ' 显示倒序数End Sub ex0302Private Sub Command1_Click()n = Val(Text1.Text)Randomizex = Int(1 + n *Rnd) Label1.Caption 第一个随机数" + Str(x)x = Int(1 + n *Rnd)Label2.Caption = " 第二个随机数" +Str(x)x = Int(1 + n *Rnd)Label3.Caption = " 第三个随机数" +Str(x)End Sub ex0303Private Sub Cmd1_Click()Lab1.Visible = TrueLab1.Caption = " 您已下达显示命令 "End SubPrivate Sub Form_Click()Cmd1.Visible = TrueEnd Subex0304Private Sub Form_KeyPress(KeyAscii As Integer)ShowPrint " 输入字符: "; Chr(KeyAscii), "ASCII 码为 ;"; KeyAscii End SubPrivate Sub Form_DblClick()ClsEnd Sub ex0305 Private Sub Form_Load()x = MsgBox(" 在这里显示提示信息 ", 4 + 0, " 请确认 ")x = MsgBox(" 在这里显示 " + Chr(13) + " 提示信息 ", 3 + 0, " x = MsgBox(" 在这里显示 " + Chr(13) + " 提示信息 ", 2 + 16 + 0,End Sub ex0401Private Sub Form_Load()Dim x As Long, s As Stringx = In putBox(" 输入一个整数(1 〜35000)")s = " 奇数"If x Mod 2 = 0 Then s = " 偶数"MsgBox s End Sub ex0402Private Sub Command1_Click()Dim a As Single, b As SingleDim c As Single, d As SingleDim m As Single, n As Single, x As SingleShowa = Val(Text1.Text)b = Val(Text2.Text)c = Val(Text3.Text)d = Val(Text4.Text)If a > b Then ' 求 a、b 中的较大数m = aElsem = bEnd IfIf c > d Then ' 求 c、d 中的较大数n = cElsen = dEnd IfIf m > n Then ' 求 m、n 中的较大数x = mElsex = nEnd IfText5.Text = x 请确认")请确认")End Subex0403Private Sub Command1_Click()Dim t As String, p As String t = Mid(Text1.Text, 5, 1) Select Case tCase "2"p = " 博士生 "Case "3"p = " 硕士生 "Case "4"p = " 本科生 "Case "5"p = " 专科生 "Case Elsep = " 无效学号 "End SelectText2.Text = Left(Text1.Text, 2) + "Text3.Text = pEnd Subex0404Private Sub Command1_Click()r = 0: g = 0: b = 0If Check1.Value = 1 Thenr = 255End IfIf Check2.Value = 1 Theng = 255End IfIf Check3.Value = 1 Thenb = 255End IfLabel1.BackColor = RGB(r, g, b)End SubPrivate Sub Command2_Click()EndEnd Subex0405Private Sub Form_Load()LabClk.Caption = "0"LabClk.Alignment = 1LabClk.BorderStyle = 1LabClk.FontSize = 22LabClk.FontName = " 黑体 "TimClk.Interval = 1000End SubPrivate Sub TimClk_Timer()LabClk.Caption = Val(LabClk.Caption) + 1End Sub ex0406 Private Sub Form_Load()Command1.Enabled = FalseCommand2.Enabled = FalseEnd SubPrivate Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Text1.SelLength > 0 ThenCommand1.Enabled = TrueEnd IfEnd SubPrivate Sub Command1_Click()Command1.Enabled = TrueCommand2.Enabled = TrueEnd SubPrivate Sub Command2_Click()Text2.Text = Text1.SelTextCommand1.Enabled = FalseCommand2.Enabled = FalseEnd Sub ex0501 Private Sub Form_Load()Dim k As Integer, s As Integer, t As Integers = 0For k = 1 To 100 Step 2s = s + kNext kShowPrint "1 〜100范围内的奇数和:";sEnd Sub ex0502 Private Sub Form_Load()Dim s As SingleShows = 0For k = 1 To 200s = s + k / (1 + k * k)Next kPrint Int(s * 10 + 0.5) / 10End Sub ex0503 Private Sub Form_Load()Showk = 2Do While k < 101s = s + k * (k - 1)k = k + 2LoopPrint sEnd Subex0504Private Sub Form_Load()Dim k As Integer, a As Integer, b As IntegerDim c As Integer, n As IntegerShown = 0Print " 三位数的水仙花数是: "For k = 100 To 999a = Int(k / 100)b = Int((k - 100 * a) / 10)c = k Mod 10If a * a * a + b * b * b + c * c * c = k Then Print kn = n + 1End IfNext kPrint " 一共有 " & n & " 个水仙花数 "End Sub ex0505Private Sub Form_Load()ShowFor k = 1000 To 9999If k Mod 78 = 0 Thena = Int(k / 1000)b = Int(k / 100) - 10 * ac = Int(k / 10) - 100 * a - 10 * bd = k Mod 10If a = b And c = d ThenPrint kEnd IfEnd IfNext kEnd Subex0506Private Sub Command1_Click()Dim s As String, y As StringDim x As String, t As Strings = Text1.Text: y = ""For k = 1 To Len(s)x = Mid(s, k, 1)t = UCase(x)If t >= "A" And t <= "Z" Theny = y + xEnd IfNext kText2.Text = yEnd Subex0507Private Sub Command1_click()FontSize = 12ClsFor i = 0 To List1.ListCount -1If List1.Selected(i) Then 'Print List1.List(i)End IfNext iEnd Subex0508Private Sub Form_Load()ShowFor a = 1 To 9For b = 1 To 9For c = 1 To 9For d = 1 To 9x = a * 1000 + b * 100 + c y = b * 1000 + a * 100 + a z = d * 100 + d * 10 + a If x - y = z ThenPrint "A=" & a & ",B=" & b & ",C=" & c & ",D=" & d End IfNext dNext cNext bNext aEnd Sub ex0601Private Sub Command1_Click()Dim a(10) As Integer, min As Integer, pos As Integer RandomizeFor i = 1 To 10 a(i) = Int(Rnd * 90 + 10) Print a(i);Next iPrintmin = a(1)pos = 1For k = 2 To 10 If a(k) < min Then min = a(k) pos = k 10 + d 10 + c 显示 "按钮单击事件逐项判断 真时为选定Next kPrint " 最小数: "; min, " 位置: "; posEnd Sub ex0602Private Sub Form_Load()Dim a As Variant, b As VariantDim c(8) As Integera = Array(3, 4, 2, 1, 5, 7, 8, 11, 13)b = Array(10, 6, 12, 9, 13, 8, 8, 1, 16)For k = 0 To 8 c(k) = a(k) + b(k)Next kShowFor k = 0 To 8Print c(k)Next kEnd Sub ex0603 Private Sub Form_Load()Dim d() As IntegerDim k As Integer, t As Integer, m As IntegerDim h As Integer, n As Integern = Val(InputBox(" 请输入数组个数 n: "))ReDim d(n)ShowPrint " 处理前数据 :"RandomizeFor k = 1 To nd(k) = Int((101 * Rnd - 50))Print d(k);Next kPrintm = Int(n / 2)For k = 1 To m h = n - k + 1 t = d(h): d(h) = d(k): d(k) = t Next kPrint " 处理的结果 :"For k = 1 To nPrint d(k);Next kEnd Subex0604Private Sub Form_Load()Dim a(8, 8) As Integer, n As IntegerDim s As Long, i As Integer, j As IntegerShown = 8For i = 1 To nFor j = 1 To nx = Int(90 * Rnd + 10) ' 产生一个随机数a(i, j) = xNext jNext is = 0For i = 1 To nFor j = 1 To ns = s + a(i, j)Next jNext iPrint " 所有元素之和; "; sPrintFor i = 1 To ns = 0For j = 1 To ns = s + a(i, j)Next jPrint " 第 "; i; " 行元素之和; "; sNext iPrints = 0For i = 1 To ns = s + a(i, i)Next iPrint " 主对角线元素之和; "; sPrints = 0For i = 1 To nFor j = 1 To nIf i = 1 Or i = n Or j = 1 Or j = n Then s = s + a(i, j)End IfNext jNext iPrint " 所有靠边元素之和; "; sEnd Sub ex0605 Option Base 1Private Sub Form_Load()Dim a(8, 8) As Integer, n As IntegerDim max As Integer, r As Integer, c As Integer Show Randomizen = 8For i = 1 To nFor j = 1 To nx = Int(900 * Rnd + 100) 'a(i, j) = xPrint x;Next jPrintNext imax = 0: r = 1: c = 1PrintFor i = 1 To nFor j = 1 To nIf a(i, j) > max Then 'max = a(i, j): r = i: c = jEnd IfNext j, iPrint " 最大值为: "; maxPrint " 位于行: "; r, " 列: "; c End Sub ex0606 Dim n As IntegerPrivate Sub Cmd1_Click()n = n + 1If n = 3 Then n = 0Opt1(n).Value = True End SubPrivate Sub Form_Load()n = 1End Sub ex0607Private Sub Form_Load()Dim a(20) As IntegerRandomizea(1) = Int(10 + 90 * Rnd)k = 1Do While k < 20x = Int(10 + 90 * Rnd) 产生一个随机数判断有无更大数For j = 1 To kIf x = a(j) Then f = 1 Exit ForEnd IfNext jIf f = 0 Thenk = k + 1 a(k) = xEnd IfLoopShowFor j = 1 To 20Print a(j)Next jEnd Sub ex0701Private Sub Form_Click() Dim s As Long s = 0For k = 1 To 10 s = s + jc(k)Next kPrint sEnd SubFunction jc(n) As LongDim t As Longt = 1For k = 1 To nt = t * kNext kjc = tEnd Functionex0702Private Sub Form_Load()Dim a As Single, b As Single, c As Single Dim d As Single, m As Single, n As Single Showa = Val(InputBox(" 输入第 1 个数 "))b = Val(InputBox(" 输入第 2 个数 "))c = Val(InputBox(" 输入第 3 个数"))d = Val(InputBox(" 输入第 4 个数 "))m = max(a, b) 'n = max(c, d) 'Print " 最大数为: " & max(m, n) End SubFunction max(x, y) As SingleIf x > y Then max = xElsemax = y 求a、 b 中的较大数求c、 d 中的较大数求m、n 中的较大End Function ex0703Private Sub Command1_Click()Dim d(5) As Single, m As SingleFor k = 0 To 5d(k) = Val(Text1(k).Text) Next kCall Max(d(0), d(1), d(2), m)Call Max(m, d(3), d(4), m)Call Max(m, m, d(5), m) Text2.Text = mEnd Sub ex0704Private Sub Form_Load() Dim x As Long Showx = Val(InputBox(" 输入一个数 "))Print x; " 的位数为: "; fnws(x) End SubFunction fnws(x As Long) As Integer Dim n As Integer n = 1 Do While x \ 10 > 0n = n + 1x = x \ 10 Loop fnws = nEnd Function ex0705Private Sub C1_Click()Form1.HideEnd Sub ex0705APrivate Sub C2_Click()Form1.ShowEnd Sub ex0706 Dim n As IntegerPrivate Sub Command1_Click()usern = Trim(Text1.Text)passw = Trim(Text2.Text)If usern = "username" And passw = "password" Then Form1.HideForm2.ShowElsen = n + 1Text1.SetFocusIf n = 3 ThenForm1.HideForm3.ShowEnd IfEnd IfText1.Text = ""Text2.Text = ""End Subex0706APrivate Sub Command1_Click()Form2.HideForm1.ShowEnd Subex0906BPrivate Sub Command1_Click()Unload Form1Unload Form2Unload Form3EndEnd Sub ex0802 Private Sub Form_Load()Dim i As Integer, j As IntegerShowFor i = 1 To 12Print String(20 - i, 32); ' For j = 1 To 2 * i - 1 'If j <= i Then 'k = j 'Elsek = 2 * i - j 'End IfIf k > 9 Then k = k + 7 ' Print Chr(k + 48); 'Next jPrint ' 输出当前行左边的空格,分号表示下一输出项紧接输出输出2*i-1 个字符按左、右两边指定输出字符左边输出的字符右边输出的字符字母的ASCII 码比数字大7 以字符格式输出换行End SubDim t As Single, f As IntegerPrivate Sub Command1_Click()RandomizeIII! For k = 1 To 30If Mid(Text1.Text, k, 1) = Mid(Text2.Text, k, 1) Then c = c + 1End IfNext k Text2.Locked = True ' 禁止录入Text4.Text = Round(c / 30 * 100, 2) & "%" ' 显示准确率End IfEnd Subex0901Private Sub Command1_Click()Open " 静夜思 .txt" For Input As #1Do While Not EOF(1) '文件未结束时,循环Input #1, xList1.AddItem xLoopClose #1End Sub ex0902 产生原稿文”按钮x = Chr(Int(Rnd * 26) + 97) 's = s + xNext kText1.Text = s 'Text2.Text = ""Text2.Locked = False 'Text2.SetFocus 'Text3.Text = ""Text4.Text = ""f = 0 'End SubPrivate Sub Command2_Click()' EndEnd SubPrivate Sub Text2_KeyUp(KeyCode As Integer,Dim c As Integer, k As IntegerIf f = 0 Then' t = Timer' f = 1'1 End IfIf Len(Text2.Text) < 30 ThenText3.Text = Round(Timer - t, 1) & "Elsec = 0For k = 1 To 30 ' 随机产生小写字母 显示在文本框中 允许录入 设置焦点 第 1 次按键标记, 0 表示未按键 “结束”按钮 As Integer) 第 1 次按键时,开始计时 用t 保存第1次按键的时间 表示已按键和进入录入过程 秒 " ' 显示用户当前所用时间统计录入正确的字母个数Dim d(1 To 20) As IntegerPrivate Sub Command1_Click() '" 产生随机数 "For i = 1 To 20 d(i) = Int(1 + 99 * Rnd) List1.AddItem d(i)Next iEnd SubPrivate Sub Command2_Click() '" 保存 "Open "MyFile4.txt" For Output As #1For i = 1 To 20Write #1, d(i)Next iClose #1End SubPrivate Sub Command3_Click() '" 读出 "Open "MyFile4.txt" For Input As #1Do While Not EOF(1) Input #1, x List2.AddItem xLoopClose #1End SubPrivate Sub Command4_Click() '" 结束 "EndEnd Sub ex0903 Private Sub Form_Load()ShowFor k = 1 To 6第 7 章\ex070" & k & ".vbp"If Dir(fn) = "" ThenPrint Mid(fn, 4) & " 未编写!! " ElsePrint Mid(fn, 4) & " 已编写!! " End IfNext kEnd Subex0904Private Sub Form_Load()chedir = "C:\Documents and Settings\Lin\My Documents\fsodir" If Dir(chedir, 16) = "" ThenMkDir chedirEnd Ifchefile = "C:\Windows\notepad.exe"If Dir(chefile) <> "" ThenFileCopy chefile, chedir & "\mynotepad.exe"End IfMsgBox " 操作完毕! "End Subex1002Private Sub A1_Click()Label1.ForeColor = vbRedEnd SubPrivate Sub A2_Click()Label1.ForeColor = vbBlueEnd SubPrivate Sub A3_Click()Label1.ForeColor = vbGreenEnd SubPrivate Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 ThenPopupMenu mun0End IfEnd Subex1003Private Sub Command1_Click()CommonDialog1.DialogTitle = " 选择文件 " CommonDialog1.Filter = " 文本文件 |*.txt"CommonDialog1.InitDir = "C:\"CommonDialog1.ShowOpenText1.Text = CommonDialog1.FileNameEnd SubPrivate Sub Command2_Click()Unload MeEndEnd Subex1101Private Sub calzc(x As Integer)Text2.Text = Round(2 * 3.14159 * x, 2)End SubPrivate Sub HV_Scroll()Dim r As Integer r = HV.ValueText1.Text = "=" & rCall calzc(r)End SubPrivate Sub Form_Load()HV.Max = 300End Subex1102Private Sub Form_Load()For k = 0 To 3 Image1(k).Stretch = TrueImage1(k).Picture = LoadPicture(" 箭头 " & k + 1 & ".bmp")Next kEnd SubPrivate Sub Image1_Click(Index As Integer) Picture1.ClsSelect Case IndexCase 0Picture1.Print "Case 1箭头向上 "Picture1.Print " Case 2Picture1.Print " Case 3 箭头向左 " 箭头向右 "Picture1.Print "End SelectEnd Sub箭头向下 "。

vb上机练习试题及答案

vb上机练习试题及答案

第一章概述一、基本要求(1)熟悉VB集‎成开发环境‎(2)掌握代码窗‎口的应用及‎录入、编辑代码的‎基本方法(3)了解VB程‎序设计的基‎本步骤二、实习内容(1)实习熟悉V‎B集成开发‎环境各组成‎部分(2)输入一个数‎,求该数的平‎方并显示结‎果第二章一、基本要求(1)熟练掌握各‎种运算符的‎应用和优先‎顺序(2)掌握各种常‎用函数的功‎能、参数和返回‎值(3)掌握立即窗‎口的使用方‎法二、实验内容(1)回答整形、长整型、单精度、双精度类型‎数据占用字‎节数。

(2)已知直角三‎角形的两条‎直角边长,求斜边长。

Priva‎t e Sub Comma‎n d1_C‎l ick()Dim a%, b%, c%a = Val(Input‎B ox("输入第一条‎直角边长"))b = Val(Input‎B ox("输入第二条‎直角边长"))c = Sqr(a ^ 2 + b ^ 2)Print‎cEnd Sub(3)给小学生随‎机出两位数‎和一位数的‎加法题。

Priva‎t e Sub Comma‎n d1_C‎l ick()Dim a%, b%, c%a = Val(Input‎B ox("输入两位数‎"))b = Val(Input‎B ox("输入一位数‎"))c = a + bPrint‎cEnd Sub(4)用文本框输‎入一个带小‎数的数,对输入的数‎四舍五入保‎留2位小数‎。

Priva‎t e Sub Comma‎n d1_C‎l ick()Dim x#, y!x = Text1‎.Texty = Round‎(x, 2)Print‎yEnd Sub(5)输入某人姓‎名,判断是否你‎的本家。

Priva‎t e Sub Comma‎n d1_C‎l ick()Dim a$, b$, p As Boole‎a nb = "李"a = Input‎B ox("输入某人的‎姓名")If Left(a, 1) = b Thenp = TrueEnd IfPrint‎pEnd Sub(6)任意输入西‎安地区的固‎定电话号码‎(原为7位),将其升为8‎位(在原号码前‎面加8)。

VB语言程序设计课后编程及上机调试参考答案

VB语言程序设计课后编程及上机调试参考答案

VB语言程序设计课后编程及上机调试参考答案VB语言程序设计课后编程及上机调试参考答案ex0101Private Sub Label1_Click()Caption = "练习"Command1.Caption = "确定"Label1.FontBold = TrueLabel1.AutoSize = TrueLabel1.Caption = "Visual Basic程序设计教程" End Subex0102Private Sub Command1_Click()Txt.Text = "我有电脑"End SubPrivate Sub Command2_Click()Txt.Text = "我没有电脑"End SubPrivate Sub Command3_Click()Txt.Text = "" '一对双撇号,中间不留空End Subex0104Private Sub Command1_Click()Dim x As Singlex = Val(Text1.Text)Text2.Text = 15 * xEnd Subex0202Private Sub Form_Click()Dim r As Single, s As Singler = 4.6s = 3.14159 * r ^ 2Text1.Text = "圆的面积为" & sEnd Subex0204Private Sub Command1_Click() '"最大化"按钮 Form1.WindowState = 2 '最大化End SubPrivate Sub Command2_Click() '"还原"按钮 Form1.WindowState = 0 '还原End SubPrivate Sub Command3_Click() '"最小化"按钮 Form1.WindowState = 1 '最小化End Subex0205Private Sub command1_click()Dim x As SingleDim y As Singlex = Val(Text1.Text)y = Val(Text2.Text)Text3.Text = x * x + y * yEnd Subex0206Private Sub command1_click()Dim x As Stringx = Text1.TextText2.Text = Left(x, 1) + Right(x, 1) End Subex0301Private Sub Form_Load()Dim x As Integer, y As IntegerDim a As Integer, b As Integer, c As Integer x = Val(InputBox("请输入一个三位数"))a = Int(x / 100) '求百位数b = Int(x / 10) - a * 10 '求十位数c = x Mod 10 '求个位数Showy = c * 100 + b * 10 + a '生成倒序数Print x; "倒序数为:"; y '显示倒序数End Subex0302Private Sub Command1_Click()n = Val(Text1.Text)Randomizex = Int(1 + n * Rnd)Label1.Caption = "第一个随机数" + Str(x)x = Int(1 + n * Rnd)Label2.Caption = "第二个随机数" + Str(x)x = Int(1 + n * Rnd)Label3.Caption = "第三个随机数" + Str(x) End Subex0303Private Sub Cmd1_Click()Lab1.Visible = TrueLab1.Caption = "您已下达显示命令"End SubPrivate Sub Form_Click()Cmd1.Visible = TrueEnd Subex0304Private Sub Form_KeyPress(KeyAscii As Integer) ShowPrint "输入字符:"; Chr(KeyAscii), "ASCII码为;"; KeyAsciiEnd SubPrivate Sub Form_DblClick()ClsEnd Subex0305Private Sub Form_Load()x = MsgBox("在这里显示提示信息", 4 + 0, "请确认")x = MsgBox("在这里显示" + Chr(13) + "提示信息", 3 + 0, "请确认")x = MsgBox("在这里显示" + Chr(13) + "提示信息", 2 + 16 + 0, "请确认")End Subex0401Private Sub Form_Load()Dim x As Long, s As Stringx = InputBox("输入一个整数(1~35000)")s = "奇数"If x Mod 2 = 0 Then s = "偶数"MsgBox sEnd Subex0402Private Sub Command1_Click()Dim a As Single, b As SingleDim c As Single, d As SingleDim m As Single, n As Single, x As Single Showa = Val(Text1.Text)b = Val(Text2.Text)c = Val(Text3.Text)d = Val(Text4.Text)If a > b Then '求a、b中的较大数m = aElsem = bEnd IfIf c > d Then '求c、d中的较大数n = cElsen = dEnd IfIf m > n Then '求m、n中的较大数x = mElsex = nEnd IfText5.Text = xEnd Subex0403Private Sub Command1_Click()Dim t As String, p As String t = Mid(Text1.Text, 5, 1)Select Case tCase "2"p = "博士生"Case "3"p = "硕士生"Case "4"p = "本科生"Case "5"p = "专科生"Case Elsep = "无效学号"End SelectText2.Text = Left(Text1.Text, 2) + "级" Text3.Text = pEnd Subex0404Private Sub Command1_Click()r = 0: g = 0: b = 0If Check1.Value = 1 Thenr = 255End IfIf Check2.Value = 1 Theng = 255End IfIf Check3.Value = 1 Thenb = 255End IfLabel1.BackColor = RGB(r, g, b)End SubPrivate Sub Command2_Click()EndEnd Subex0405Private Sub Form_Load()LabClk.Caption = "0"LabClk.Alignment = 1LabClk.BorderStyle = 1LabClk.FontSize = 22LabClk.FontName = "黑体"TimClk.Interval = 1000End SubPrivate Sub TimClk_Timer()LabClk.Caption = Val(LabClk.Caption) + 1 End Subex0406Private Sub Form_Load()Command1.Enabled = FalseCommand2.Enabled = FalseEnd SubPrivate Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)If Text1.SelLength > 0 ThenCommand1.Enabled = TrueEnd IfEnd SubPrivate Sub Command1_Click()Command1.Enabled = TrueCommand2.Enabled = TrueEnd SubPrivate Sub Command2_Click()Text2.Text = Text1.SelTextCommand1.Enabled = FalseCommand2.Enabled = FalseEnd Subex0501Private Sub Form_Load()Dim k As Integer, s As Integer, t As Integer s = 0For k = 1 To 100 Step 2s = s + kNext kShowPrint "1~100范围内的奇数和:"; sEnd Subex0502Private Sub Form_Load()Dim s As SingleShows = 0For k = 1 To 200s = s + k / (1 + k * k) Next kPrint Int(s * 10 + 0.5) / 10 End Subex0503Private Sub Form_Load()Showk = 2s = 0Do While k < 101s = s + k * (k - 1)k = k + 2LoopPrint sEnd Subex0504Private Sub Form_Load()Dim k As Integer, a As Integer, b As Integer Dim c As Integer, n As IntegerShown = 0Print "三位数的水仙花数是:"For k = 100 To 999a = Int(k / 100)b = Int((k - 100 * a) / 10)c = k Mod 10If a * a * a + b * b * b + c * c * c = k ThenPrint kn = n + 1End IfNext kPrint "一共有" & n & "个水仙花数"End Subex0505Private Sub Form_Load()ShowFor k = 1000 To 9999If k Mod 78 = 0 Thena = Int(k / 1000)b = Int(k / 100) - 10 * ac = Int(k / 10) - 100 * a - 10 * bd = k Mod 10If a = b And c = d ThenPrint kEnd IfEnd IfNext kEnd Subex0506Private Sub Command1_Click()Dim s As String, y As StringDim x As String, t As Strings = Text1.Text: y = ""For k = 1 To Len(s)x = Mid(s, k, 1)t = UCase(x)If t >= "A" And t <= "Z" Theny = y + xEnd IfNext kText2.Text = yEnd Subex0507Private Sub Command1_click() '"显示"按钮单击事件FontSize = 12ClsFor i = 0 To List1.ListCount - 1 '逐项判断 If List1.Selected(i) Then '真时为选定Print List1.List(i)End IfNext iEnd Subex0508Private Sub Form_Load()ShowFor a = 1 To 9For b = 1 To 9For c = 1 To 9For d = 1 To 9x = a * 1000 + b * 100 + c * 10 + d y = b * 1000 + a * 100 + a * 10 + c z = d * 100 + d * 10 + aIf x - y = z ThenPrint "A=" & a & ",B=" & b & ",C=" & c & ",D=" & dEnd IfNext dNext cNext bNext aEnd Subex0601Private Sub Command1_Click()Dim a(10) As Integer, min As Integer, pos As IntegerRandomizeFor i = 1 To 10a(i) = Int(Rnd * 90 + 10)Print a(i);Next iPrintmin = a(1)pos = 1For k = 2 To 10If a(k) < min Thenmin = a(k)pos = kEnd IfNext kPrint "最小数:"; min, "位置:"; posEnd Subex0602Private Sub Form_Load()Dim a As Variant, b As VariantDim c(8) As Integera = Array(3, 4, 2, 1, 5, 7, 8, 11, 13)b = Array(10, 6, 12, 9, 13, 8, 8, 1, 16)For k = 0 To 8c(k) = a(k) + b(k)Next kShowFor k = 0 To 8Print c(k)Next kEnd Subex0603Private Sub Form_Load()Dim d() As IntegerDim k As Integer, t As Integer, m As Integer Dim h As Integer, n As Integern = Val(InputBox("请输入数组个数n:"))ReDim d(n)ShowPrint "处理前数据 :"RandomizeFor k = 1 To nd(k) = Int((101 * Rnd - 50))Print d(k);Next kPrintm = Int(n / 2)For k = 1 To mh = n - k + 1t = d(h): d(h) = d(k): d(k) = tNext kPrint "处理的结果 :"For k = 1 To nPrint d(k);Next kEnd Subex0604Private Sub Form_Load()Dim a(8, 8) As Integer, n As IntegerDim s As Long, i As Integer, j As Integer ShowRandomizen = 8For i = 1 To nFor j = 1 To nx = Int(90 * Rnd + 10) '产生一个随机数a(i, j) = xNext jNext is = 0For i = 1 To nFor j = 1 To ns = s + a(i, j)Next jNext iPrint "所有元素之和;"; sPrintFor i = 1 To ns = 0For j = 1 To ns = s + a(i, j)Next jPrint "第"; i; "行元素之和;"; sNext iPrints = 0For i = 1 To ns = s + a(i, i)Next iPrint "主对角线元素之和;"; sPrints = 0For i = 1 To nFor j = 1 To nIf i = 1 Or i = n Or j = 1 Or j = n Then s = s + a(i, j)End IfNext jNext iPrint "所有靠边元素之和;"; sEnd Subex0605Option Base 1Private Sub Form_Load()Dim a(8, 8) As Integer, n As IntegerDim max As Integer, r As Integer, c As Integer ShowRandomizen = 8For i = 1 To nFor j = 1 To nx = Int(900 * Rnd + 100) '产生一个随机数a(i, j) = xPrint x;Next jPrintNext imax = 0: r = 1: c = 1PrintFor i = 1 To nFor j = 1 To nIf a(i, j) > max Then '判断有无更大数max = a(i, j): r = i: c = jEnd IfNext j, iPrint "最大值为:"; maxPrint "位于行:"; r, "列:"; cEnd Subex0606Dim n As IntegerPrivate Sub Cmd1_Click()n = n + 1If n = 3 Then n = 0Opt1(n).Value = TrueEnd SubPrivate Sub Form_Load()n = 1End Subex0607Private Sub Form_Load()Dim a(20) As IntegerRandomizea(1) = Int(10 + 90 * Rnd) k = 1Do While k < 20x = Int(10 + 90 * Rnd) f = 0For j = 1 To kIf x = a(j) Then f = 1Exit ForEnd IfNext jIf f = 0 Thenk = k + 1a(k) = xEnd IfLoopShowFor j = 1 To 20Print a(j)Next jEnd Subex0701Private Sub Form_Click() Dim s As Longs = 0For k = 1 To 10s = s + jc(k)Next kPrint sEnd SubFunction jc(n) As Long Dim t As Longt = 1For k = 1 To nt = t * kNext kjc = tEnd Functionex0702Private Sub Form_Load()Dim a As Single, b As Single, c As SingleDim d As Single, m As Single, n As SingleShowa = Val(InputBox("输入第1个数"))b = Val(InputBox("输入第2个数"))c = Val(InputBox("输入第3个数"))d = Val(InputBox("输入第4个数"))m = max(a, b) '求a、b中的较大数n = max(c, d) '求c、d中的较大数Print "最大数为:" & max(m, n) '求m、n中的较大数End SubFunction max(x, y) As SingleIf x > y Thenmax = xElsemax = yEnd IfEnd Functionex0703Private Sub Command1_Click()Dim d(5) As Single, m As Single For k = 0 To 5d(k) = Val(Text1(k).Text)Next kCall Max(d(0), d(1), d(2), m) Call Max(m, d(3), d(4), m)Call Max(m, m, d(5), m)Text2.Text = mEnd Subex0704Private Sub Form_Load()Dim x As LongShowx = Val(InputBox("输入一个数")) Print x; "的位数为:"; fnws(x) End SubFunction fnws(x As Long) As Integer Dim n As Integern = 1Do While x \ 10 > 0n = n + 1x = x \ 10Loopfnws = nEnd Functionex0705Private Sub C1_Click()Form1.HideEnd Subex0705APrivate Sub C2_Click()Form1.ShowEnd Subex0706Dim n As IntegerPrivate Sub Command1_Click() usern = Trim(Text1.Text)passw = Trim(Text2.Text)If usern = "username" And passw = "password" ThenForm1.HideForm2.ShowElsen = n + 1Text1.SetFocusIf n = 3 ThenForm1.HideForm3.ShowEnd IfEnd IfText1.Text = ""Text2.Text = ""End Subex0706APrivate Sub Command1_Click()Form2.HideForm1.ShowEnd Subex0906BPrivate Sub Command1_Click()Unload Form1Unload Form2Unload Form3EndEnd Subex0802Private Sub Form_Load()Dim i As Integer, j As IntegerShowFor i = 1 To 12Print String(20 - i, 32); '输出当前行左边的空格,分号表示下一输出项紧接输出For j = 1 To 2 * i - 1 '输出2*i-1个字符If j <= i Then '按左、右两边指定输出字符k = j '左边输出的字符k = 2 * i - j '右边输出的字符End IfIf k > 9 Then k = k + 7 '字母的ASCII 码比数字大7Print Chr(k + 48); '以字符格式输出Next jPrint '换行Next iEnd Subex0803Dim t As Single, f As IntegerPrivate Sub Command1_Click() '“产生原稿文”按钮Randomizes = ""For k = 1 To 30x = Chr(Int(Rnd * 26) + 97) '随机产生小写字母Next kText1.Text = s '显示在文本框中Text2.Text = ""Text2.Locked = False '允许录入Text2.SetFocus '设置焦点Text3.Text = ""Text4.Text = ""f = 0 '第1次按键标记,0表示未按键End SubPrivate Sub Command2_Click() '“结束”按钮EndEnd SubPrivate Sub Text2_KeyUp(KeyCode As Integer, ShiftAs Integer)Dim c As Integer, k As IntegerIf f = 0 Then'第1次按键时,开始计时t = Timer '用t保存第1次按键的时间f = 1 '1表示已按键和进入录入过程End IfIf Len(Text2.Text) < 30 ThenText3.Text = Round(Timer - t, 1) & "秒" '显示用户当前所用时间Elsec = 0For k = 1 To 30 '统计录入正确的字母个数If Mid(Text1.Text, k, 1) =Mid(Text2.Text, k, 1) Thenc = c + 1End IfNext kText2.Locked = True '禁止录入Text4.Text = Round(c / 30 * 100, 2) & "%" '显示准确率End IfEnd Subex0901Private Sub Command1_Click()Open "静夜思.txt" For Input As #1Do While Not EOF(1) '文件未结束时,循环Input #1, xList1.AddItem xLoopClose #1End Subex0902Dim d(1 To 20) As IntegerPrivate Sub Command1_Click() '"产生随机数" For i = 1 To 20d(i) = Int(1 + 99 * Rnd)List1.AddItem d(i)Next iEnd SubPrivate Sub Command2_Click() '"保存" Open "MyFile4.txt" For Output As #1 For i = 1 To 20Write #1, d(i)Next iClose #1End SubPrivate Sub Command3_Click() '"读出" Open "MyFile4.txt" For Input As #1Do While Not EOF(1)Input #1, xList2.AddItem xLoopClose #1End SubPrivate Sub Command4_Click() '"结束" EndEnd Subex0903Private Sub Form_Load()ShowFor k = 1 To 6fn = "..\第7章\ex070" & k & ".vbp"If Dir(fn) = "" ThenPrint Mid(fn, 4) & "未编写!!"ElsePrint Mid(fn, 4) & "已编写!!"End IfNext kEnd Subex0904Private Sub Form_Load()chedir = "C:\Documents and Settings\Lin\My Documents\fsodir"If Dir(chedir, 16) = "" ThenMkDir chedirEnd Ifchefile = "C:\Windows\notepad.exe"If Dir(chefile) <> "" ThenFileCopy chefile, chedir & "\mynotepad.exe"End IfMsgBox "操作完毕!"End Subex1002Private Sub A1_Click()Label1.ForeColor = vbRedEnd SubPrivate Sub A2_Click()Label1.ForeColor = vbBlueEnd SubPrivate Sub A3_Click()Label1.ForeColor = vbGreenEnd SubPrivate Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)If Button = 2 ThenPopupMenu mun0End IfEnd Subex1003Private Sub Command1_Click()CommonDialog1.DialogTitle = "选择文件"CommonDialog1.Filter = "文本文件|*.txt"CommonDialog1.InitDir = "C:\"CommonDialog1.ShowOpenText1.Text = CommonDialog1.FileName End SubPrivate Sub Command2_Click()Unload MeEndEnd Subex1101Private Sub calzc(x As Integer)Text2.Text = Round(2 * 3.14159 * x, 2) End SubPrivate Sub HV_Scroll()Dim r As Integerr = HV.ValueText1.Text = "=" & rCall calzc(r)End SubPrivate Sub Form_Load()HV.Max = 300End Subex1102Private Sub Form_Load()For k = 0 To 3Image1(k).Stretch = TrueImage1(k).Picture = LoadPicture("箭头" & k + 1 & ".bmp")Next kEnd SubPrivate Sub Image1_Click(Index As Integer)Picture1.Font.Size = 20Picture1.ClsSelect Case IndexCase 0Picture1.Print "箭头向上"Case 1Picture1.Print "箭头向左"Case 2Picture1.Print "箭头向右"Case 3Picture1.Print "箭头向下"End SelectEnd Sub41。

VB期末考试上机题编程答案

VB期末考试上机题编程答案

VB 期末考试上机题编程答案详细要求:1.新建一个工程,编写一个找出全部四位好运数显示在列表框中,并将好运数的个数显示在文本框中。

所谓好运数是指凡前两位数字之和等于后两位数字之和的四位数。

将原窗体文件和工程文件分别另存为为 f.frm 和 p.vbp,保留在D 盘的 VBTest文件夹中。

如不按要求保留,造成文件没法上传,结果自负! 1、程序参照界面如下图,编程时不得增添或减少界面对象或改变对象的种类,窗体及界面元素大小适中,且均可见;2、单击 "查找 "按钮,则开始查找并在列表框中显示结果,并在文本框中显示好运数的个数; 3、单击“消除”按钮,则将列表框和文本框清空;4、单击“退出”按钮,结束程序运转;5、程序中应包括一个过程,用于判断一个数是不是好运数。

解: Private Sub Command1_Click()Dim i As Integer, a As IntegerFor i = 1000 To 9999If k(i) Then List1.AddItem i: a = a + 1Next iText1.Text = aEnd SubPrivate Sub Command2_Click()List1.ClearText1.Text = ""End SubPrivate Sub Command3_Click()EndEnd SubPrivate Function k(n As Integer) As IntegerDim i As Integer, a As Integer, s1 As Integer, s2 As IntegerDim s As Strings = CStr(n)For i = 1 To Len(s) / 2s1 = s1 + Mid(s, i, 1)s2 = s2 + Mid(s, Len(s) + 1 - i, 1)Next iIf s1 = s2 Then k = TrueEnd Function2.新建一个工程,编写求某一自然数因子和的程序。

vb上机考试题库及答案86套

vb上机考试题库及答案86套

vb上机考试题库及答案86套VB上机考试题库及答案86套1. 选择题- 1.1 VB中,用于声明变量的关键字是()。

- A. Dim- B. Declare- C. Let- D. Set- 答案:A- 1.2 下列哪个选项是VB中合法的变量名?()- A. 123abc- B. _name- C. name$- D. name 2- 答案:B2. 填空题- 2.1 VB中,使用()函数可以将字符串转换为数值。

- 答案:Val- 2.2 在VB中,使用()关键字可以定义一个数组。

- 答案:Dim3. 简答题- 3.1 简述VB中的事件驱动编程的概念。

- 答案:事件驱动编程是一种编程范式,程序的执行流程由外部事件(如用户操作、消息、定时器等)触发,而不是按照预先定义的顺序执行。

4. 编程题- 4.1 编写一个VB程序,实现计算两个数的和并输出结果。

- 答案:```vbDim num1 As IntegerDim num2 As IntegerDim sum As Integernum1 = 5num2 = 10sum = num1 + num2Debug.Print "The sum is: " & sum```5. 判断题- 5.1 VB中,使用“=”符号可以比较两个变量的值是否相等。

() - 答案:错误。

应该使用“==”符号进行比较。

- 5.2 在VB中,可以使用“End”关键字来结束一个程序的执行。

()- 答案:正确。

6. 综合应用题- 6.1 设计一个VB程序,实现用户输入姓名和年龄,程序输出“欢迎你,[姓名],你今年[年龄]岁。

”- 答案:```vbSub Main()Dim name As StringDim age As Integername = InputBox("请输入你的姓名:")age = Val(InputBox("请输入你的年龄:"))MsgBox "欢迎你," & name & ",你今年" & age & "岁。

计算机二级VB上机操作练习题及答案

计算机二级VB上机操作练习题及答案

计算机二级VB上机操作练习题及答案计算机二级VB上机操作练习题及答案Visual Basic(简称VB)是Microsoft公司开发的一种通用的基于对象的程序设计语言,下面店铺为为大家带来计算机二级VB上机操作练习题及答案,希望大家喜欢!一、基本操作题(1)在名称为Forml、标题为“球类项目”且没有最大化和最小化按钮的窗体上画1个名称为Combol的组合框。

组合框中的文本内容为空,表项内容有“乒乓球”、“羽毛球”和“网球”3项。

运行后的窗体如图所示。

注意:存盘时必须存放在考生文件夹下,工程文件名为sjtl.vbp,窗体文件名为sjtl.frm。

(2)在名称为Forml、标题为“转换”的窗体上,画1个名称为Shapel、边框宽度为3的形状。

再画两个标题分别为“椭圆”和“圆”的命令按钮。

如下图所示。

要求:编写适当的事件过程,使得单击“椭圆”按钮时,Shapel 的形状变换为椭圆;单击“圆”按钮时,Shapel的形状变换为圆。

程序中不得使用变量,每个事件过程中只能写一条语句。

注意:存盘时必须存放在考生文件夹下,工程文件名为sjr2.vbp,窗体文件名为sjr2.frm。

二、简单应用题(1)考生文件夹中有工程文件sjt3.vbv。

窗体上显示有一个列表框和一个文本框,且列表框中已有若干列表项。

程序的功能是,程序运行时,当用户在列表框中单击并选中某个列表项时,该项的内容将显示到文本框中,用户可以在文本框中对相关内容进行编辑,按回车键后,能够用编辑好的内容替换被选中的列表项,并自动清空文本框;当双击某个列表项时,则从列表框中删除该列表项;当用户直接在文本框中键入文本并按回车键后,则把该文本添加为列表框的一个新列表项,添加完成后,将文本框清空。

运行窗体如图所示。

要求:程序已经给出,但不完整,请将其中的注释符去掉,把“?”改为正确的内容,以实现上述程序功能。

注意:考生不得修改窗体文件中已经存在的控件和程序。

最后程序按原文件名存盘。

vb上机答案全部

vb上机答案全部

实验一Form1.print “程序设计基础教程”End subPrivate sub form_dblclick()Form1.clsEnd subDim a as single,b as single,c as single a=val(text1.text)b=val(text2.text)c=a*btext3.text=str(c)end subDim n as integer,a as singlen=val(text1.text)a= n^(1/3)text2.text=str(a)end subText1.text=“visual basic 程序设计”end subPrivate Sub Command2_click()Text1.text=“”end subText2.text=left(text1.text,5)end subPrivate Sub Command2_click()Text3.text=len(text1.text)end subForm1.Move 0, 0End SubPrivate Sub Command2_Click()Form1.Height = Form1.Height * 1.2Form1.Width = Form1.Width * 1.2End Sub7.Const pi as single=3.14159Command1_click()Dim a as single,b as single,c as single,s as single a=val(text1.text)b=val(text2.text)c=val(text3.text)s=a*b*sin((c*pi)/180)/2text4.text=round(s ,2)end sub实验二顺序Const pi as single=3.14159Private Sub Command1_click()Dim r as single,v as singler=val(text1.text)v=4/3 *pi*r^3label1.caption=format(v, “0.00”)end subDim a as single,b as single,c as single,d as single a=val(text1.text)b=val(text2.text)c=val(text3.text)d=(a+b+c)/3text4.text=format(d, “0.00”)end subText1.locked=falseEnd subPrivate Sub Text1_changeCommand2.enable=trueEnd subPrivate Sub Command_click()Text1.locked=trueCommand2.enable=falseEnd subText1.text=“欢迎光临”End subCommand2_click()Text1.text=“谢谢再见”End subText1.selstart=8Text1.sellength=9End subCommand2_click()Label2.caption=text1.seltext End subConst pi as single=3.14159Dim r as single,h as singlePrivate Sub Command click()Dim s as singler=text1.texth=text2.texts=2*pi*r^2+2*pi*r*htext3.text=format(s, “0.000”) end subPrivate Sub command2 click()dim v as singlev=pi*r^2*htext4.text=format(v, “0.000”) end subDim a as string,b as stringPrivate Sub Command1_click()a=text1.textb=text2.texttext3.text=“a” & “b”end subPrivate Sub command2_click()dim t as stringa=text1.textb=text2.textt=aa=bb=ttext1.text=atext2.text=blabel1.caption=“交换成功”end sub实验三选择Dim n as integerIf (n mod 3=0 )and (n mod 7=0 ) then Label2.caption=“Yes”ElseLabel2.caption=“No”End ifEnd subDim x as single,y as singlex=text1.texty=text2.textif x>0 and y>0 thentext3.text=“第一象限”elseif x<0 and y>0 thentext3.text=“第二象限”elseif x<0 and y<0 thentext3.text=“第三象限”else x>0 and y<0 thentext3.text=“第四象限”end ifend subDim a as single,b as single,c as single,d as single a=text1.textb=text2.textc=text3.textd=a+b+cif d>=270 thenif d>=285 thentext4.text=“Gold Medal”elsetext4.text=“Silver Medal”end ifelseif d>240 thentext4.text=“Bronze Medal”elseif a>95 or b>95 or c>95 thentext4.text=“Honor Medal”elsetext4.text=“No Medal”end ifend ifend subText.text=“我是博士生”End subOption2_clickText.text=“我是硕士生”End subOption3_clickText.text=“我是本科生”End subIf Check1.Value ThenLabel1.FontUnderline = TrueElseLabel1.FontUnderline = FalseEnd IfEnd SubPrivate Sub Check2_Click()If Check2.Value ThenLabel1.FontStrikethru = TrueElseLabel1.FontStrikethru = FalseEnd IfEnd SubDim n as singlen=text1.textif n=<4 thentext2.text=format(10,“0.0”)elseif n>4 and n<=15 thentext2.text=format(10+1.2*(n-4),“0.0”)elsetext2.text=format(1.8*n,“0.0”)end ifend subIf text1.text=“Teacher” thenIf text2.text=“123456” thenLabel3.caption=“登录成功”ElseLabel3.caption=“密码不正确”End ifElseif text1.text=“Student” thenIf text2.text=“654321” thenLabel3.caption=“登录成功”ElseLabel3.caption=“密码不正确”End ifElseLabel3.caption=“用户未注册”End ifEnd sub实验四循环Dim n As Integer, i As Integer, a As Long n = Text1.Texta = 0For i = 1 To nIf (i Mod 3 = 0) And (i Mod 7 <> 0) Thena = a + iEnd IfNext iLabel1.Caption = aEnd SubDim n As Integer, m As Integer, i As Integern = Text1.Text n=val(text1.text)m = Text2.Text m=val(text2.text)If m >= n Then for i=n to 1 step -1For i = n To 1 Step -1 if n mod i=0 and m mod i=0 then If (m Mod i = 0) And (n Mod i) = 0 Then text3.text=str(i)Text3.Text = I exit forExit For end ifEnd If next iNext iElseFor i = m To 1 Step -1If (m Mod i = 0) And (n Mod i = 0) ThenText3.Text = iExit ForEnd IfNext iEnd IfEnd SubDim n As Integer, m As Integer, i As Integer, a As Integer, s As Integer, flag AsBooleanm = Text1.Textn = Text2.Texts = 0For a = m To nflag = TrueFor i = 2 To a - 1If a Mod i = 0 Thenflag = FalseExit ForEnd IfNext iIf flag = True Then s = s + a Next aText3.Text = sEnd SubTimer1.Enabled = TrueEnd SubPrivate Sub Command2_Click() Timer1.Enabled = FalseLabel1.Left = 100End SubPrivate Sub Timer1_Timer() Label1.Left = Label1.Left + 100 End SubDim n As Single, i As Single, a As Single, s As Single n = Label1.Captions = 0For i = 1 To nFor a = 1 To is = s + aNext aNext iText1.Text = sEnd SubPrivate Sub HScroll1_Change()Label1.Caption = HScroll1.ValueEnd SubDim s As Single, n As Long, t As Long, i As Longs = Text1.Textt = 1For i = 1 To Len(s)If Right(s, 1) = "1" Thenn = n + tEnd Ift = t * 2s = Left(s, Len(s) - 1)Next iLabel1.Caption = nEnd SubPrivate Sub Command2_Click()Dim a As Long, q As Longa = Text1.TextDo While (a > 0)q = a Mod 2 & qa = a \ 2LoopLabel1.Caption = qEnd SubTimer1.Enabled = TrueCommand1.Enabled = FalseCommand1.Caption = "继续"Command2.Enabled = TrueEnd SubPrivate Sub Command2_Click()Command2.Enabled = FalseCommand1.Enabled = TrueTimer1.Enabled = FalseEnd SubPrivate Sub Timer1_Timer()Label1.FontSize = Label1.FontSize * 1.1 If Label1.FontSize > 100 ThenLabel1.FontSize = 8End IfEnd Sub实验五数组Private Sub Command1_Click()Dim i As IntegerText1.text=""For i = 1 To 10a(i) = Int(Rnd * 81) + 10Text1.Text = Text1.Text & a(i) & Space(2) Next iEnd SubPrivate Sub Command2_Click()Dim i As Integer, j As Integer, t As Integer Text2.text=""For i = 1 To 9For j = i + 1 To 10If a(i) > a(j) Thent = a(j)a(j) = a(i)a(i) = tEnd IfNext jNext iFor i = 1 To 10If a(i) Mod 3 = 0 ThenText2.Text = Text2.Text & a(i) & Space(2) End IfNext iEnd SubPrivate Sub Command1_Click()Dim i As IntegerFor i = 1 To 10a(i) = Int(Rnd * 26) + 65Text1.Text = Text1.Text & a(i) & Space(2)Next iEnd SubPrivate Sub Command2_Click()Dim i As Integer, max As Integermax = a(1)For i = 2 To 10If max < a(i) Thenmax = a(i)End IfNext iText2.Text = maxText3.Text = Chr(max)End SubPrivate Sub Command1_Click()Dim i As IntegerFor i = 1 To 100a(i) = Int(Rnd * 26) + 65Text1.Text = Text1.Text & Chr(a(i)) & Space(2) Next iEnd SubPrivate Sub Command2_Click()Dim i As Integer, b As Integer, j As Integer r = 0b = Asc(Text2.Text)For i = 1 To 100If a(i) = b Thenj = j + 1End IfNext iText3.Text = jEnd SubPrivate Sub Command1_Click()Dim i As Integer, j As IntegerText1.Text = ""For i = 1 To 5For j = 1 To 5a(i, j) = Int(Rnd * 90) + 10Text1.Text = Text1.Text & a(i, j) & Space(2) Next jText1.Text = Text1.Text & vbCrLfNext iEnd SubPrivate Sub Command2_ClickDim i as Integer ,j as Integer ,s as Integer For i = 1 to 5j = 6 – is=s+a( i ,j )next iLabel1.caption =sEnd SubPrivate Sub Command1_Click()Dim n As Integer, i As Integeri = Val(Text1.Text)ReDim a(1 To i)a(1) = 1a(2) = 1For n = 3 To ia(n) = a(n - 1) + a(n - 2)Next nText2.Text = a(i)End SubPrivate Sub Command1_Click()Dim i As IntegerText1.text=""For i = 1 To 50a(i) = Int(Rnd * 90) + 10Text1.Text = Text1.Text & a(i) & Space(2) Next iEnd SubPrivate Sub Command2_Click()Dim i As IntegerText2.Text = 0For i = 1 To 50If a(i) Mod 3 = 0 And a(i) Mod 7 = 0 Then Text2.Text = Val(Text2.Text) + a(i)End IfNext iEnd SubPrivate Sub Command1_Click()Dim i As Integer, j As IntegerText1.Text = ""For i = 1 To 4For j = 1 To 4a(i, j) = Int(Rnd * 41) + 10Text1.Text = Text1.Text & a(i, j) & Space(2)Next jText1.Text = Text1.Text & vbCrLfNext iEnd SubPrivate Sub Command2_Click()Dim i As Integer,j as integerFor i=1 to 4t=a(i,1)a(i,1)=a(i,3)a(i,3)=tNext tFor i = 1 To 4For j = 1 To 4Label1.Caption = Label1.Caption & a(i, j) & Space(2) Next jLabel1.Caption = Label1.Caption & vbCrLfNext iEnd Sub实验六常用控件Private Sub Op_Click(Index As Integer)Dim a As Integer, b As Integer, c As Integera = Val(Text1.Text)b = Val(Text2.Text)Select Case IndexCase 0c = a + bCase 1c = a - bCase 2c = a * bCase 3c = a / bEnd SelectText3.Text = Str(c)End SubPrivate Sub Command1_Click()Dim n As IntegerFor n = 1 To 10a(n) = Int(Rnd * 81) + 10List1.AddItem a(n)Next nEnd SubPrivate Sub Command2_Click()Dim i As Integer, j As Integer, k As Integer, t% For i = 1 To 9For k = i + 1 To 10If a(i) > a(k) Thent = a(i)a(i) = a(k)a(k) = tEnd IfNext kNext iFor i = 1 To 10List2.AddItem a(i)Next iEnd SubPrivate Sub Command1_Click()Timer1.Enabled = FalseCommand2.Enabled = TrueCommand1.Enabled = FalseEnd SubPrivate Sub Command2_Click()Timer1.Enabled = TrueCommand1.Enabled = TrueCommand2.Enabled = FalseEnd SubPrivate Sub Command3_Click()List1.RemoveItem List1.ListIndexEnd SubPrivate Sub Timer1_Timer()List1.AddItem Int(Rnd * 90000 + 10000) End SubDim n As Integer, s As Integers = 0For n = 0 To 4If List1.Selected(n) = True Thens = s + 1End IfNext nText1.Text = sEnd SubList1.AddItem Combo1.TextEnd SubPrivate Sub List1_DblClick()List1.RemoveItem List1.ListIndexEnd SubText1.Text = Combo1.TextEnd SubPrivate Sub Command2_Click()Combo1.List(Combo1.ListIndex) = Text1.TextEnd SubPrivate Sub Timer1_TimerDim n as integerIf n>Combo1.ListCount-1 then n=0Combo1.ListIndex = nn=n+1End SubPrivate Sub Command1_ClickTimer1.Enabled =TrueCommand1.Enabled = FalseCommand2.Enabled = TrueEnd SubPrivate Sub Command2.ClickTimer1.Enabled = FalseCommand1.Enabled = TrueCommand2.Enabled =FalseEnd SubPrivate Sub Command3_Click()For j = 0 To Combo1.ListCount - 1If Combo1.List(j) = Trim(Text1.Text) Then Exit ForEnd IfNext jIf j = Combo1.ListCount ThenLabel1.Caption = "No Found"ElseLabel1.Caption = "Found"End IfEnd Sub实验七过程Dim i As Integer, n As Integer, p As Double n = Val(Text1.Text)p = 0For i = 1 To np = p + fact(i)Next iText2.Text = Str(p)End SubFunction fact(ByVal n As Integer) As Double Dim i As Integer, p As Doublep = 1For i = 1 To np = p * iNext ifact = pEnd FunctionDim x As Integer, y As Integer, z As Integer x = Val(Text1.Text)y = Val(Text2.Text)z = Val(Text3.Text)Swap x, ySwap x, zSwap y, zText4.Text = x & " " & y & Space(2) & z End SubPrivate Sub Swap(ByRef x%, ByRef y%)Dim t As IntegerIf x < y Thent = x: x = y: y = tEnd IfEnd SubDim m As Integer, n As Integerm = Val(Text1.Text)n = Val(Text2.Text)Text3.Text = m * n / Gcd(m, n)End SubFunction Gcd(ByVal m%, ByVal n%) As Integer Dim i As IntegerFor i = m To 1 Step -1If m Mod i = 0 And n Mod i = 0 ThenGcd = iExit FunctionEnd IfNext iEnd FunctionDim x As Integer, n As Integerx = Val(Text1.Text)n = Val(Text2.Text)Text3.Text = Square(x, n)End SubFunction Square(ByVal x%, ByVal n%) As Double Dim i As IntegerFor i = 0 To nSquare = Square + x ^ iNext iEnd FunctionDim m As Integer, n As Integer, i As Integer Text3.Text = ""m = Val(Text1.Text): n = Val(Text2.Text)For i = m To nIf Isprime(i) ThenText3.Text = Text3.Text & i & " "End IfNext iEnd SubFunction Isprime(n As Integer) As Boolean Dim i As IntegerIsprime = TrueFor i = 2 To n - 1If n Mod i = 0 ThenIsprime = FalseExit FunctionEnd IfNext iEnd FunctionPrivate Sub Command1_Click()Dim i As IntegerReDim a(9)Text1.Text = ""For i = 0 To 9a(i) = Int(Rnd * 90) + 10Text1.Text = Text1.Text & a(i) & Space(2) Next iEnd SubFunction sort(b() As Integer)Dim i As Integer, j As Integer, t As Integer For i = 0 To 8For j = i + 1 To 9If b(j) < b(i) Thent = b(j)b(j) = b(i)b(i) = tEnd IfNext jNext iFor i = 0 To 9sort = sort & b(i) & Space(2)Next iEnd FunctionPrivate Sub Command2_Click()Label1.Caption = sort(a())End SubDim i As Integersak = 0For i = 0 To k - 1sak = sak + a * 10 ^ iNext iEnd FunctionPrivate Sub Command1_Click()Dim i As Integer, n As Integer, s As Long, a As Integer a = Val(Text1.Text)n = Val(Text2.Text)s = 0For i = 1 To ns = sak(a, i) + sNext iText3.Text = sEnd Sub实验八图形Picture1.Picture = LoadPicture(App.Path & "\Wys.bmp") End SubPrivate Sub Command2_Click()Picture1.Picture = LoadPicture()End Sub2.If Check1.Value = 1 ThenImage1.BorderStyle = 1ElseImage1.BorderStyle = 0End IfEnd SubPrivate Sub Check2_Click()If Check1.Value = 1 ThenImage1.Picture = LoadPicture(App.Path & "\Pic.jpg") ElseImage1.Picture = LoadPicture()End IfEnd SubShape1.Shape = HScroll1.ValueEnd SubPrivate Sub VScroll1_Change()Shape1.FillStyle = VScroll1.ValueEnd SubPrivate Sub Command1_Click()Picture1.Line (0, 600)-(1600, 600)End SubPrivate Sub Command2_Click()Picture1.ClsPicture1.Circle (800, 600), 500, , , , 2End SubIf keyascii>48 or keyascii<57 ThenKeyascii=0Label1.Caption = "非法输入"ElseLabel1.Caption = "合法输入"End IfEnd SubImage1.Stretch = TrueImage1.Width = Image1.Width * Sqr(2 ^ (1 / 2)) Image1.Height = Image1.Height * Sqr(2 ^ (1 / 2)) End SubPrivate Sub Command2_Click()Image1.Stretch = TrueImage1.Width = Image1.Width * Sqr(2)Image1.Height = Image1.Height * Sqr(2)End SubPrivate Sub Command3_Click()Image1.Stretch = FalseEnd SubPicture1.backcolor=rgb(hsred.value,hsgreen.value,hsblue.value) End subHsgreen_changePicture1.backcolor=rgb(hsred.value,hsgreen.value,hsblue.value) End subHsred_changePicture1.backcolor=rgb(hsred.value,hsgreen.value,hsblue.value) End sub实验九文件Private Sub Command1_Click()Dim i As IntegerText1.Text = ""i = 1Open App.Path & "\Grade.txt" For Input As #1Do While Not EOF(1)Input #1, a(i)Text1.Text = Text1.Text & a(i) & Space(2)i = i + 1LoopClose #1End SubPrivate Sub Command2_Click()Dim i As Integer, s As Integers = 0For i = 1 To 30If a(i) = 100 Thens = s + 1End IfNext iText2.Text = sEnd SubDim s As StringText1.Text = ""Open App.Path & "\Infile.txt" For Input As #1 Do While Not EOF(1)Line Input #1, sText1.Text = Text1.Text & s & vbCrLfLoopClose #1End SubPrivate Sub Command2_Click()Dim a As Stringa = UCase(Text1.Text)Text1.Text = aOpen App.Path & "\Outfile.txt" For Output As #1 Print #1, aClose #1End SubPrivate Sub Command1_Click()Dim s As String, i As IntegerText1.Text = ""i = 1Open App.Path & "\Datain.txt" For Input As #1 Do While Not EOF(1)Input #1, a(i)Text1.Text = Text1.Text & a(i) & Space(2)i = i + 1LoopClose #1End SubPrivate Sub Command2_Click()Dim i As Integer, s As Integers = 0For i = 1 To 20If a(i) Mod 3 = 0 ThenText2.Text = Text2.Text & a(i) & Space(2)End IfNext iEnd SubDim s As StringText1.Text = ""Open App.Path & "\Dialog.txt" For Input As #1 Do While Not EOF(1)Line Input #1, sText1.Text = Text1.Text & s & vbCrLfLoopClose #1End SubPrivate Sub Command2_Click()Dim i As Integer, s As String, r As Integer r = 0For i = 1 To Len(Text1.Text)s = Mid(Text1.Text, i, 1)If Asc(s) >= 65 And Asc(s) <= 90 Thenr = r + 1End IfNext iText2.Text = rEnd SubPrivate Sub Command3_Click()Dim i As Integer, s As String, r As Integer r = 0For i = 1 To Len(Text1.Text)s = Mid(Text1.Text, i, 1)If Asc(s) >= 97 And Asc(s) <= 122 Thenr = r + 1End IfNext iText3.Text = rEnd SubFile1.Path = Dir1.PathEnd SubPrivate Sub Drive1_Change()Dir1.Path = Drive1.DriveEnd SubPrivate Sub File1_Click()Dim a As StringIf Right(File1.Path, 1) = "\" Thena = File1.Path + File1.FileNameElsea = File1.Path + "\" + File1.FileNameEnd IfText1.Text = aEnd Sub实验十界面设计Text1.locked=falseFSave.enable=trueEnd subFSave_clickText1.locked=tureFSave.enable=falseEnd sub2.dis_clicktext1.text=“计算机等级考试”end sub3.clea_clicktext1.text=“”end sub4.sqadd_clicklabel1.caption=(val(text1.text)^2)+(val(text2.text)^2) end subsqsub_clicklabel1.caption=(val(text1.text)^2)-(val(text2.text)^2) end submnuclean_clicktext1.text=“”text2.text=“”label1.caption=“”end sub4.Private Sub MnuRed_Click()Shape1.FillColor = vbRedEnd SubPrivate Sub MunBlue_Click()Shape1.FillColor = vbBlueEnd Sub5.Private Sub Command1_Click()Dim a As Integer, i As Integera = Text1.TextFor i = 1 To aIf Sqr(i) = Int(Sqr(i)) ThenList1.AddItem iEnd IfNext iEnd Sub制作人:102宿舍、尤昌波只供参考。

VB7

VB7
11
7.2 其他循环语句
2、Do循环的格式有两种,分别是: 、 循环的格式有两种 分别是: 循环的格式有两种, 格式1: 格式 :Do <语句序列 语句序列> 语句序列 [ Exit Do] Loop [While | Until<条件表达式 条件表达式>] 条件表达式 格式2: 条件表达式>] 格式 :Do [While | Until<条件表达式 条件表达式 <语句序列 语句序列> 语句序列 [ Exit Do] Loop
9
7.2 其他循环语句
1、 While循环不是确定循环次数的循环结构, 是根 循环不是确定循环次数的循环结构, 循环不是确定循环次数的循环结构 据给定“条件”的成立与否决定程序的流程。 据给定“条件”的成立与否决定程序的流程。其格式 为: While <条件表达式> 条件表达式> <语句序列> 语句序列> Wend 功能:如果“条件表达式”的值为True True时 功能:如果“条件表达式”的值为True时,则执行循 环中的“语句序列” 即循环体。 环中的“语句序列”,即循环体。
20
7.3 循环控制结构的嵌套
编写完数程序,输出1000之内的所有完数。 之内的所有完数。 编写完数程序,输出 之内的所有完数 说明: 完数” 说明:“完数”是指一个数恰好等于它的因子 之和, 的因子为1、 、 而 之和,如6的因子为 、2、3而6=1+2+3,因而 的因子为 , 6就是完数。 就是完数。 就是完数
8
7.1 For 型循环结构语句
【问题扩展3】求解1×2×3…×10 问题扩展3 求解1 3…× 技术:【累积器】 技术: 累积器】 算法:T=T*i (1<=i<=100) 算法:

2010秋VB07上机答案

2010秋VB07上机答案

2010年(秋)上机 Visual Basic(VB07)答案一、改错【题目】本程序的功能是,找出所有由1~6中的5个不同数字组成的、奇偶相间隔的5位数。

Option ExplicitPrivate Sub Command1_Click()Dim i As Long, k As Integer, s As String, Ch As String * 1Dim BL As Boolean, j As Integer, St As StringSt = "123456"'k = 0 '位置错For i = 12345 To 65432s = CStr(i)k = 0For j = 1 To 6Ch = Mid(St, j, 1)If InStr(s, Ch) <> 0 Then k = k + 1Next jIf k = 5 ThenBL = FalseCall Verify(i, BL)If BL Then List1.AddItem iEnd IfNext iEnd SubPrivate Sub Verify(n As Long, Flg As Boolean) 'err n As IntegerDim i As Integer, s As String, Ch As String * 1s = CStr(n) 'err s = Str(n)If Mid(s, 1, 1) Mod 2 = 0 ThenFor i = 1 To 5 Step 2If Mid(s, i, 1) Mod 2 <> 0 Then Exit SubNext iElseFor i = 1 To 5 Step 2If Mid(s, i, 1) Mod 2 <> 1 Then Exit SubNext iEnd IfFlg = TrueEnd Sub二、编程题【题目】编写程序,找出斐波那契数列指定项数范围内的为素数的数据项。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
程序中用到的控件及其属性见表3.33和表3.34。
表3.33
控件 图片框 通用对话框
属性 Name Picture Name DialogTitle
设置值 P1 Open.ico CD1 打开文件
表3.34
控件 通用对话框
属性 Fliter FliterIndex InitDir
设置值 Word文档| *.doБайду номын сангаас 1 C:
步骤2:分析并编写程序代码。
End Sub
Private Sub C3_Click()
Text2.Text = Text1.Text
End Sub
步骤4:调试并运行程序,关闭程序后按题目要求存盘。
(4)【操作步骤】
步骤1:新建一个窗体,按照题目要求建立图片框及通用对话框控件并设置图片框及通用对话框相应属性。
End Sub
Private Sub Command2 Click()
Dim n As Integer, t As String, word num As Integer
n = Len(s): t = ""
For i = 1 To n
c = Mid(s, i, 1)
If c <> " " Then
(1【操作步骤】
步骤1:建立界面,按照题目要求建立一个名称为Ch1的复选框数组并设置其相应属性。
步骤2:按照步骤1设置其他控件相关属性,程序中用到的控件及属性见表3.28和表3.29。
表3.28
控件 标签 复选框1
属性 Name Caption Caption Index Value
End Sub
步骤3:调试并运行程序,关闭程序后按题目要求存盘。
(3)【操作步骤】
步骤1:新建一个窗体,按照题目要求建立标签控件并设置标签的相应属性。
步骤2:按照步骤1设置其他控件相关属性,程序中用到的控件及其属性见表3.31和表3.32。
表3.31
t = t + c
Else
If foundhuiwen(t) Then
word num = word num + 1
End If
t = ""
End If
Next i
Text1.Text = word num
End Sub
参考答案
Private Sub P1_Click()
CD1.ShowOpen
End Sub
步骤3:调试并运行程序,关闭程序后按题目要求存盘。
(5)【操作步骤】
步骤1:打开本题工程文件,按照题目要求建立标签控件并设置标签的Caption属性为"回文个数为",再添加一个文本框Text1,并设置文本框的初始内容为空。
'以下Function 过程用于判断字符串是否为回文
Function foundhuiwen(p As String)
'考生编写
End Function
Private Sub Form Unload(Cancel As Integer)
Open App.Path & "\out5.dat" For Output As #1
设置值 L1 业余爱好 体育 0 1
表3.29
控件 复选框2 复选框3
属性 Caption Index Enabled Caption Index
设置值 音乐 1 False 美术 2
步骤3:调试并运行程序,关闭程序后按题目要求存盘。
(2)【操作步骤】
步骤1:新建一个"标准EXE"工程,在窗体中添加个文本框,在属性设置窗口中将其Name属性值设置为Text1。打开菜单设计器,按表3.30中的设置建立菜单项。
Print #1, Text1.Text
Close #1
End Sub
程序结束
参考答案
Function foundhuiwen(p As String)
If StrReverse(p) = p Then foundhuiwen = True
End Function
步骤3:调试并运行程序,关闭程序后按题目要求存盘。
表3.30
标题 操作 显示 隐藏
名称 M1 Show Hide
内缩符号 0 1 1
步骤2:编写程序代码。
参考答案
Private Sub Hide_Click()
Text1.Visible = False
End Sub
Private Sub Show_Click()
Text1.Visible = True
表3.32
步骤3:分析并编写程序代码。
程序提供代码
程序结束
参考答案
Private Sub C1_Click()
Text1.PasswordChar = ""
End Sub
Private Sub C2_Click()
Text1.PasswordChar = "?"
步骤2:分析并编写程序代码。
程序提供代码
Option Base 1
Dim s As String
Private Sub Command1 Click()
Open App.Path & "\in5.dat" For Input As #1
s = Input(LOF(1), #1)
Close #1
相关文档
最新文档