资源描述:
《2009年12月江苏信息技术学业水平测试算法与程序设计上机题库》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、PrivateSubCommand1_Click()DimxAsString,yAsStringDimiAsIntegerDimtemp1AsString,temp2AsStringx=Text1.Texty=""Fori=1To①(Text1.Text)temp1=Mid(x,i,1)temp2=②y=y+temp2NextiText2.Text=③EndSubPrivateSubCommand1_Click()DimiAsInteger,aAsInteger,bAsInteger,cAsIntegerFori=100To999a=i①b=(i-a*②)10c=iMod10Ifa^3+
2、b^3+c^3=iThenPrinti③EndSubPrivateSubCommand1_Click()Dims(9)AsSingleFori=0To9①=Val(InputBox("请输入一个数"))NextiFori=9To0Step②Print③NextiEndSubPrivateSubCommand1_Click()Dimh,m,s,ssAsIntegerss=Val(①)h=②m=(ss-h*3600)60s=(ss-h*3600)Mod③Label1.Caption=CStr(h):Label2.Caption=CStr(m):Label3.Caption=CStr(s)End
3、SubPrivateSubCommand1_Click()Dima,b,c,maxAsIntegera=Val(Text1.Text)b=Val(Text2.Text)c=Val(Text3.Text)Ifa>bThenmax=aElse①Ifc>maxThen②Label3.Caption=CStr(③)EndSubPrivateSubCommand1_Click()********************打开“15”,填空使能输出上图。Dimi,jAsIntegerFori=1To①PrintTab(6-i);Forj=1To②Print③;NextjPrintNextiEndSubPr
4、ivateSubCommand1_Click()Dimx,sAsSinglex=Val(Text1.Text)If①Thens=4*②Elses=4*xEndIfLabel1.Caption=CStr(③)EndSub共有56人要乘船,大船限乘6人,小船限乘4人,坐大船每条10元,坐小船每条8元。打开"Z:22工程1.vbp"填空完成程序,使得当单击"显示所有可能的乘船方式"按钮时,输出全部可能的大船数、小船数及所需要的钱数。PrivateSubCommand1_Click()Dimi,jAsInteger'变量i表示大船数,j表示小船数DimmAsInteger'变量m表示所需钱数Pr
5、int"大船数","小船数","所需钱数"Fori=1To①j=Int((56-i*6)/4)+1m=②+i*10Printi,j,mNextiEndSubDima,b,c,x,nAsIntegerPrivateSubCommand1_Click()RandomizeLabel6.Caption="第"&n&"道题"a=Int(Rnd*10)b=Int(Rnd*10)Label1.Caption=aLabel2.Caption=bn=n+1EndSubPrivateSubCommand2_Click()c=a+bx=Val(①)Ifc=②ThenLabel3.Caption="正确"Else
6、Label3.Caption="错误"EndIfEndSubPrivateSubForm_Load()③EndSub26题。点按钮,实现分别使标签“Label1”上移或下移100个单位。PrivateSubCommand1_Click()①EndSubPrivateSubCommand2_Click()②EndSubPrivateSubCommand1_Click()Dima,b,c,pAsSinglea=Val(Text1.Text)b=Val(①)c=Val(Text3.Text)p=b*b-4*a*cIf②ThenX1=(-b+Sqr(p))/(2*a)X2=(-b-Sqr(p))/(
7、2*a)Print"X1=";X1Print"X2=";X2③Print"该方程无实数根"EndIfEndSubPrivateSubCommand1_Click()DimxAsSingle,yAsSinglea=3:b=-5①=Val(InputBox("请输入x的值"))Ifx<0Then②=x+5*aElsey=x-2*b③Print"y=";CStr(y)EndSubPrivateSubCommand1