资源描述:
《vb实验教材的实验、习题答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、第一章VB开发环境与VB概述习题答案习题一、选择题1. 2. 3. 4. 5. 6. 7. 8. 9. 10. BAABDBAACB11. 12. 13. 14. CDAD 第二章常用控件与界面设计习题答案习题一、选择题1. 2. 3. 4. 5. 6. 7. 8. 9. 10. CBCAABBBCC11. 12. 13. 14. 15. 16. 17. 18. 19. 20. BBDABBBCCD21. 22. 23. 24. 25. 26. 27. 28. 29. 30. BBBCCCABBC31. 32. 33. 34. 35. 36. 37. 38. 39.
2、40. BCBBDBDDBA41. 42. 43. 44. 45. 46. 47. 48. 49. 50. BABBDAABDC51. 52. 53. 54. 55. 56. 57. 58. 59. 60. DDCDDCACCB61. B 第三章实验与习题实验实验3_1‘算术运算PrivateSubCommand1_Click()ConstaAsSingle=3,bAsSingle=2,cAsSingle=-1,dAsSingle=6DimxAsSingle,yAsSingle,zAsSingle,mAsSinglex=2:y=1:z=
3、1:m=1List1.ClearList1.AddItema/(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.AddItem1+1/(1+1/m)List1.AddItem1/2*(d/3)^(2*x)List1.AddItemLog(y+Cos(x)^2)List1.AddItemAbs((Exp(x)+Sin(x)^3)/(x+y))List1.AddItemLog((Exp(x*y)+Abs(1/Tan(z)+Cos(x)^3))/(x+y-
4、z))List1.AddItemSin(45*3.1415/180)+(Exp(10)+Log(10))/Sqr(x+y+1)List1.AddItemLog(a)/Log(b)EndSub‘关系运算PrivateSubCommand2_Click()List1.ClearList1.AddItemMid("VisualBasic",1,12)=Right("LanguageVisualBasic",12)List1.AddItem"ABCRG">="abcde"List1.AddItemInt(134.69)>=CInt(134.9)List1.AddItem78.9
5、/32.77<=97.5/43.87And-45.4>-4.98List1.AddItemStr(32.345)=CStr(32.345)EndSub‘逻辑运算PrivateSubCommand3_Click()DimxAsInteger,yAsIntegerDimC1AsInteger,C2AsInteger,C3AsIntegerC1=70:C2=80:C3=90x=9:y=-2List1.ClearList1.AddItemx+y<10Andx-y>0List1.AddItem(x%>=0Andy%>=0)Or(x%<0Andy%<0)List1.AddItemx
6、=0Xory=0List1.AddItemC1+C2+C3>=255OrC1>90AndC2>90AndC3>80EndSub实验3_2略实验3_3略实验3_4‘零售结算PrivateSubCommand1_Click()DimdjAsSingle,slAsSingle,jeAsSingle,nAsIntegerLabel1.Caption="金额:"dj=InputBox("请输入商品的单价:","单价框")sl=InputBox("请输入商品的数量:","数量框",1)je=dj*sln=MsgBox("共计金额="&je,vbOKCancel+vbInformat
7、ion,"结果")Ifn=vbOKThenLabel1.Caption="金额:"&Str(je)&"元"EndSub‘产生随机数PrivateSubCommand2_Click()DimmAsInteger,nAsIntegerDimx1AsInteger,x2AsInteger,x3AsIntegerm=Val(Text1.Text):n=Text2.TextRandomizex1=Int(Rnd*(n-m+1)+m)x2=Int(Rnd*(n-m+1)+m)x3=Int(Rnd*(n-m+1)+m)Label4.Caption="结