vb程序设计实验教程与习题选解 王杰华 郑国平 主编

2019-04-10 10:17

第一章 VB开发环境与VB概述 习题答案

习题

一、选择题

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. B

A A B D B A A C B C D A D 第二章 常用控件与界面设计 习题答案

习题

一、选择题

15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. C B B A 75. B B B C A C C B B A C B D A D D C B B B D B B D D B B D C C C B D C C A D B C B C B A A A D B B C A B B C B C D B 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 第三章实验与习题

实验

实验3_1 ?算术运算

Private Sub Command1_Click()

Const a As Single = 3, b As Single = 2, c As Single = -1, d As Single = 6 Dim x As Single, y As Single, z As Single, m As Single x = 2: y = 1: z = 1: m = 1

List1.Clear

List1.AddItem a / (b + c / b)

List1.AddItem (x + Sqr(x ^ 2 + 1)) ^ (1 / 3)

List1.AddItem ((2 * y) / (a * x + b * y) * (a * x - b * y)) List1.AddItem 1 + 1 / (1 + 1 / m) List1.AddItem 1 / 2 * (d / 3) ^ (2 * x) List1.AddItem Log(y + Cos(x) ^ 2)

List1.AddItem Abs((Exp(x) + Sin(x) ^ 3) / (x + y))

List1.AddItem Log((Exp(x * y) + Abs(1 / Tan(z) + Cos(x) ^ 3)) / (x + y - z)) List1.AddItem Sin(45 * 3.1415 / 180) + (Exp(10) + Log(10)) / Sqr(x + y + 1) List1.AddItem Log(a) / Log(b) End Sub ?关系运算

Private Sub Command2_Click() List1.Clear

List1.AddItem Mid(\ List1.AddItem \ List1.AddItem Int(134.69) >= CInt(134.9)

List1.AddItem 78.9 / 32.77 <= 97.5 / 43.87 And -45.4 > -4.98 List1.AddItem Str(32.345) = CStr(32.345) End Sub ?逻辑运算

Private Sub Command3_Click() Dim x As Integer, y As Integer

Dim C1 As Integer, C2 As Integer, C3 As Integer C1 = 70: C2 = 80: C3 = 90 x = 9: y = -2 List1.Clear

List1.AddItem x + y < 10 And x - y > 0

List1.AddItem (x% >= 0 And y% >= 0) Or (x% < 0 And y% < 0)

List1.AddItem x = 0 Xor y = 0

List1.AddItem C1 + C2 + C3 >= 255 Or C1 > 90 And C2 > 90 And C3 > 80 End Sub 实验3_2 略

实验3_3 略

实验3_4 ?零售结算

Private Sub Command1_Click()

Dim dj As Single, sl As Single, je As Single, n As Integer Label1.Caption = \金额:\

dj = InputBox(\请输入商品的单价:\单价框\ sl = InputBox(\请输入商品的数量:\数量框\

je = dj * sl

n = MsgBox(\共计金额=\结果\ If n = vbOK Then Label1.Caption = \金额:\元\End Sub ?产生随机数

Private Sub Command2_Click() Dim m As Integer, n As Integer

Dim x1 As Integer, x2 As Integer, x3 As Integer m = Val(Text1.Text): n = Text2.Text Randomize

x1 = Int(Rnd * (n - m + 1) + m) x2 = Int(Rnd * (n - m + 1) + m) x3 = Int(Rnd * (n - m + 1) + m)

Label4.Caption = \结果为:\ End Sub ?求逆序数

Private Sub Command3_Click()

Dim a As Integer, h As Integer, t As Integer, n As Integer Randomize

a = Int(Rnd * (999 - 100 + 1) + 100) h = Mid(CStr(a), 1, 1) t = Mid(CStr(a), 2, 1) n = Right(CStr(a), 1)

Label5.Caption = a & \End Sub 实验3_5 略

习题 选择题

1-20: DBBDB DDBCA DDDCD DB_DB 21-40: DCDAA B_ACA BCADA B_BCD 41-60: BCBDC CADBA CBDDD ABAAA 61-80:BBCAB BDAAA CBBDD CBDAD 81-89:CBDBB BADC

填空题

1、2 -32768~32767

2、整型 长整型 单精度 双精度 3、0 False “”

4、Chr(Int(Rnd*(Asc(“L”)-Asc(“C”))+Asc(“C”))) x>0 And y>0 Or x<0 And y<0

c>=”a” And c<=”z” Or c>=”A” And c<=”Z” x>=10 And x<20 x

7、a=1 b=1 a=2 b=1 a=3 b=1 a=4 b=1

8、Y Mod 4=0 And Y Mod 100<>0 Or Y Mod 400 =0 9、He Said, “Good morning”. 10、EDEF

11、(A>0 And A<>Int(A)) And (B<0 And B<>Int(B)) 12、a+b+c+d

(a+b+c+d)/4 sum aver

13、(f-2*h)/2

(4*h-f)/2

简答题

1、略

2、Private Sub Form_Click() Const g = 9.8

Dim V0 As Single, t As Single Dim S As Single

V0 = InputBox(\请输入V0的值:\

t = InputBox(\请输入时间t的值:\ S = (1 / 2) * g * t ^ 2 + V0 * t MsgBox (\位移量为:\End Sub

3、Private Sub Command1_Click()

Dim l As Single, w As Single, h As Single Dim s As Single l = Text1.Text w = Text2.Text h = Text3.Text

s = (l * w + l * h + w * h) * 2 Label1.Caption = s End Sub


vb程序设计实验教程与习题选解 王杰华 郑国平 主编.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2013年年度管理方案书

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: