basic程序设计期末复习一(编辑修改稿)内容摘要:

明。 三、阅读程序题 阅读下列程序并写出程序运行结果 1. Private Sub Form_Click() Static a As Integer Dim b As Integer a = a+2 b = b+2 Text1=a Text2=b End Sub 写出程序运行时连续单击 三 次窗体后,文本框 Text1和 Text2显示结果。 2. Private Sub Form_Click() Static a As String Dim b As String a = a + A b = b + B Text1 = a Text2 = b End Sub 写出程序运行时连续单击三次窗体后,文本框 Text1和 Text2显示结果。 3. Private Sub Command1_Click() Dim n As Integer, y As Integer, x As Integer a = 1 Do While a 20 n = n + 1 b = a + b a = a * (a + 1) Loop = n = a = b End Sub 写出程序运行时单击 Command1 后,文件框 Text Text2 和 Text3 的输出结果。 5 4. Private Sub Command1_Click() Dim A(1 To 5) As Integer Dim x As Integer For i = 1 To 5 A(i) = i Next i i = 1 Do While x 3 A(i) = A(i) * x x = x + 2 i = i + 1 Loop = A(1) = A(2) End Sub 写出程序运行时单击 Command1 后,文本框 Text Text2 的输出结果。 5. Private Sub Form_Click() Dim i As Integer, k As Integer k = 0 For i = 1 To 4 If i 2 Then k = k + 5 Else k = k + 2 End If Next i Print i, k End Sub 写出程序运行时单击窗体后, Form1上的输出结果。 6. Private Sub Form_Click() Dim i As Integer, k As Integer, c As Integer For i = 1 To 5 If i Mod 2 = 0 Then k = k + 2 Else c = c + 2 End If Next i Print k, c 6 End Sub 写出程序运行时单击窗体后, Form1上的输出结果。 7. Sub Change(ByVal x As Integer, ByVal y As Integer) Dim t As Integer t = x x = y y = t Print x, y End Sub Private Sub Form_Click() Dim a As Integer, b As Integer a = 10: b = 20 Change a, b Print a, b End Sub 写出程序运行时单击窗体后, Form1上的输出结果。 四、 完善程序题 1.假设用 Access 创建了一个名为“学生 .MDB”的数据库,并在其中创建了一张名为“学生基本情况”的数据表,表中存放了学生的基本信息,如图 1 所示。 现在要求利用 VB 编写一个数据库查询程序,程序的运行界面如图 2所示,基本逻辑是:首先文本框 (Text1)中输入希望查询的学生学号,然后 点击“查询”按钮 (Command1),如果数据库中存在该。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。