资源描述:
《vb的实验与习题答案.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、VB的实验与习题答案.docVB开发环境与VB概述习题答案习题一、选择题 BAABDBAACBCDAD 常用控件与界面设计习题答案习题一、选择题 CBCAABBBCCBBDAB BBCCDBBBCCCABBC BCBBDBDDBABABBD AABDCDDCDDCACCB B 第三章实验与习题实验实验3_1‘算术运算PrivateSub
2、Command1_Click()ConstaAsSingle=3,bAsSingle=2,cAsSingle=-1,dAsSingle=6DimxAsSingle,yAsSingle,zAsSingle,mAsSinglex=2:y=1:z=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.AddI
3、tem1/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-z))List1.AddItemSin(45*3.1415/180)+(Exp(10)+Log(10))/Sqr(x+y+1)List1.AddItemLog(a)/Log(b)EndSub‘关系运算PrivateSubCommand2_Clic
4、k()List1.ClearList1.AddItemMid("VisualBasic",1,12)=Right("LanguageVisualBasic",12)List1.AddItem"ABCRG">="abcde"List1.AddItemInt(134.69)>=CInt(134.9)List1.AddItem78.9/32.77<=97.5/43.87And-45.4>-4.98List1.AddItemStr(32.345)=CStr(32.345)EndSub‘逻辑运算PrivateSubCommand3_Cl
5、ick()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=0Xory=0List1.AddItemC1+C2+C3>=255OrC1>90AndC2>90AndC3>80EndSub实验3_2略实验3_3略实验3_
6、4‘零售结算PrivateSubCommand1_Click()DimdjAsSingle,slAsSingle,jeAsSingle,nAsIntegerLabel1.Caption="金额:"dj=InputBox("请输入商品的单价:","单价框")sl=InputBox("请输入商品的数量:","数量框",1)je=dj*sln=MsgBox("共计金额="&je,vbOKCancel+vbInformation,"结果")Ifn=vbOKThenLabel1.Caption="金额:"&Str(je)&"元"EndS
7、ub‘产生随机数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="结果为:"&Str(x1)&Str(x2)&Str(x3)EndSub‘求逆序数PrivateSubCo
8、mmand3_Click()DimaAsInteger,hAsInteger,tAsInteger,nAsIntegerRandomizea=Int(Rnd*(999-100+1)+100)h=Mid(CStr(a),1,1)t=Mid(CStr(a),2,1)n=Right