資源描述:
《vb部分考試試題及答案.doc》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、1.圖5PrivateSubCommand1_Click()'考生應(yīng)完成的程序'*******Begin************Open“in5.dat”forinputas#1Input#1,sClose#1Text1.text=sEndSubprivateSubCommand2_Click()'考生應(yīng)完成的程序Stetemp2=””Fori=1tolen(s)Ch=mid(s,i,1)Ifimod2<>0thenIfisletter(cstr(ch))=truethenIfch=”Z”thenCh=”A”Elseifch=
2、”z”thenCh=”a”ElseCh=chr(asc(ch)+1)EndifEndifElseIfisletter(cstr(ch))=truethenIfch=”A”thenCh=”Z”Elseifch=”a”thenCh=”z”ElseCh=chr(asc(ch)-1)EndifEndifEndifStrtemp2=strtemp2+chNextiText2.text=strtemp2'*******End************EndSubFunctionisletter(aAsString)AsBooleanIf"A
3、"<=aAnda<="Z"Or"a"<=aAnda<="z"Thenisletter=TrueElseisletter=FalseEndIfEndFunctionPrivateSubCommand3_Click()Open"out5.dat"ForOutputAs#1Print#1,Text2.TextClose#1EndSub2.(a)(b)PrivateSubCommand1_Click()IfOption1.Value=TrueAndText1.Text<>""ThenList1.AddItemText1.TextTex
4、t1.Text=""ElseIfOption2.Value=TrueAndList1.ListIndex>=0ThenList1.RemoveItemList1.ListIndexElseMsgBox"未輸入或未選定項(xiàng)目"EndIfEndIfEndSub3.(a)(b)PrivateSubCommand1_Click()'需考生編寫程序'*******Begin************DimsAsStringOpen"in5.txt"ForInputAs1LineInput#1,sClose#1Text1.Text=s'***
5、****End************EndSubPrivateSubCommand2_Click()DimoldSenAsStringDimnewSenAsStringDimchAsStringDimlastChAsStringoldSen=Text1.Textstrlen=Len(oldSen)lastCh=Left(oldSen,1)Fori=1Tostrlench=Mid(oldSen,i,1)IflastCh=""Thench=UCase(ch)EndIf'newSen=newSen=newSen&chlastCh=
6、chNextiText1.Text=newSenEndSubPrivateSubCommand3_Click()Open"out5.txt"ForOutputAs#1'Write#1,?Close#1EndSub4.'============考生應(yīng)完成的程序(開始)=============='*************begin*************DimsAsRecordtypeOpen"in5.dat"ForRandomAs#1Len=Len(s)maxval=0minval=300Fork=1To20Get#1,,
7、ssumval=s.a1+s.a2+s.a3Ifsumval>maxvalThenmaxval=sumvalIfsumval8、rint#1,minval%Close#1EndSub5.Dima(10)AsIntegerPublicSubSave()OpenApp.Path&"out5.txt"ForOutputAs#1Print#1,Label4.CaptionClose#1EndSubPriva