basic程序设计综合练习二(编辑修改稿)内容摘要:

0: Sum2 = 1 For i = 1 To 3 For j = 1 To i Sum2 = Sum2 * j Next j Sum1 = Sum1 + Sum2 Next i Print Sum1 End Sub 写出程序运行时单击 Command1 按纽 后, Form1 上的输出结果。 2. Private Sub Command1_Click() x = 1 Do While x 50 x = (x + 1) * (x + 2) n = n + 1 Loop = Str(n) = Str(x) End Sub 写出程序运行时单击 Command1 按纽 后, text1 和 text2 上的输出结果。 3. Private Sub Command1_Click() Dim A(1 To 5) As Integer Dim b As Integer For b = 1 To 5 A(b) = b Next b = A(b 2) End Sub 写出程序运行时单击 Command1 按纽 后, Text1 上的输出结果。 4. Private Sub Form_Click() a = 2: b = 2 5 Print A=。 a。 B=。 b Call mult(a) Print A=。 a。 ,B=。 b End Sub Private Sub mult(x) x = 3 + x b = 5 + b End Sub 写出程序运行后, 单击窗体时的输出结果。 5. 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 = 5: b = 8 Change a, b Print a, b End Sub 写出程序运行时单击 Command1 按纽 后, Form1 上的输出结果。 6. Private Sub Form_Click() Dim A(1 To 3) As String Dim c As Integer, j As Integer A(1) = 5 A(2) = 10 A(3) = 15 c = 2 For j = 1 To 3 c = c + Val(A(j)) Next j Print c End Sub 写出程序运行时单击窗体后,窗体 Form1 上的结果。 6 7. Private Sub Command1_Click() Static Sum As Integer Dim I As Integer I = 1 Do Sum = Sum + I I = I + 1 Loop While I = 5 = Sum = I End Sub 写出程序运行时两次单击 Command1 按纽 后,文本框 Text Text2 上的输出结果。 8. Public Sub change1(ByVal x As Integer, ByVal y As Integer) Dim t As Integer t = x x = y y = t End Sub Public Sub change2(x As Integer, y As Integer) Dim t As Integer t = x x = y y = t End Sub Private Sub Form_Click() Dim a As Integer, b As Integer a = 20: b = 40 change1 a, b A1=。 a, B1=。 b a = 20: b = 40 change2 a, b A2=。 a, B2=。 b End Sub 写出程序运行时,单击窗体 Form1 上的输出结果。 四、 完善程序题 1.假设用 Access 创建了一个名为“ ”的数据库,并在其中创建了一张名为“档案”的数据表,表中存放了人员的基本信息,如图 1 所示。 7 要求使用 ADO 对象和 MSFlexGrid 控件设计数据库列表显示程序。 程序的设计界面和运行结果如图 图 3 所示。 程序如下,请补充完整。 Public As New Sub main() 图 1 用 Access 创建的档案数据表 图 2 程序设计界面 图 3 程序。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。