资源描述:
《信息技术学业水平测试VB套操作题复习及答案ppt课件.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、PrivateSubCommand1_Click()Dimh,m,s,ssAsIntegerss=Val(Text1.Text)h=ss3600m=(ss-h*3600)60s=(ss-h*3600)Mod60Label1.Caption=CStr(h)Label2.Caption=CStr(m)Label3.Caption=CStr(s)EndSubVB操作一PrivateSubCommand1_Click()DimxAsString,yAsStringDimiAsIntegerDimtemp1AsString,temp2AsStringx=Text1
2、.Texty=""Fori=1ToLen(Text1.Text)temp1=Mid(x,i,1)temp2=9-temp1y=y+temp2NextiText2.Text=yEndSubVB操作一PrivateSubCommand1_Click()DimiAsInteger,aAsInteger,bAsInteger,cAsIntegerFori=100To999a=i100b=(i-a*100)10c=iMod10Ifa^3+b^3+c^3=iThenPrintiNextiEndsubVB操作一PrivateSubCommand1_Click()Dim
3、s(9)AsSingleFori=0To9s(i)=Val(InputBox("请输入一个数"))NextiFori=9To0Step-1Prints(i)NextiEndSubVB操作一PrivateSubCommand1_Click()Dima,b,c,maxAsIntegera=Val(Text1.Text)b=Val(Text2.Text)c=Val(Text3.Text)Ifa>bThenmax=aElsemax=bIfc>maxThenmax=cLabel3.Caption=CStr(max)EndSubVB操作一VB操作二打不开PrivateS
4、ubCommand1_Click()DimsAsSingleDimqAsSingleDimaAsSingleDimbAsSingleDimcAsSinglea=Val(InputBox("请输入边长a的值:"))b=Val(InputBox("请输入边长b的值:"))c=Val(InputBox("请输入边长c的值:"))q=(a+b+c)/2s=Sqr(q*(q-a)*(q-b)*(q-c))PrintsEndSubVB操作三PrivateSubCommand1_Click()DimyearAsIntegeryear=Val(InputBox("请输入年号
5、:"))If((yearMod4=0)And(yearMod100<>0))Or(yearMod400=0)ThenPrint"是闰年"ElsePrint"不是闰年"EndIfEndSubVB操作三PrivateSubCommand1_Click()DimaAsInteger,bAsIntegerDimbaiAsInteger,shiAsIntegerDimgAsIntegera=Val(Text1.Text)bai=a100shi=(a-bai*100)10g=aMod10b=g*100+shi*10+baiText2.Text=CStr(b)EndS
6、ubVB操作三PrivateSubCommand1_Click()DimxAsSingle,yAsSinglea=3:b=-5x=Val(InputBox("请输入x的值"))Ifx<0Theny=x+5*aElsey=x-2*bEndIfPrint"y=";CStr(y)EndSubVB操作三PrivateSubCommand1_Click()Dima,b,c,pAsSinglea=Val(Text1.Text)b=Val(Text2.Text)c=Val(Text3.Text)p=b*b-4*a*cIfp>=0ThenX1=(-b+Sqr(p))/(2*
7、a)X2=(-b-Sqr(p))/(2*a)Print"X1=";X1Print"X2=";X2ElsePrint"该方程无实数根"EndIfEndSubVB操作三PrivateSubCommand1_Click()DimWuyuanAsIntegerDimYiyuanAsIntegerDimWujiaoAsIntegerForWuyuan=1To20ForYiyuan=1To100Wujiao=100-Wuyuan-YiyuanIfWuyuan*5+Yiyuan*1+Wujiao*0.5=100ThenPrint"Wuyuan="&Wuyuan&",Yiy
8、uan="&Yiyuan&",Wujiao="&Wu