资源描述:
《VB期末考试》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1.ᦪInStr("VBᦟ""”)Ḅ32.ᙠᑖ!"IntAஹBlஹst'D)*,ஹ-.,ஹ/01,'23,4ᑡ678ᙠ:;<=┯Ḅ?—Bl=#True#3.G⌕ᙠ78Ia=Array(l,2,3,4,5)ḄO☢QR!"a,ᑣTUḄQR?DimaAsVariant4.XYZᨵ\]CommandlḄabᢥd\]ᑖListlஹList2Ḅᑡ⊤᪾ᐸListlḄMultiSelectkឋm1(Simple),oᨵ4pqr:PrivateSubCommandl_Click()Fori=0ToListl.ListCount-1IfListl.Selected(i)=TrueThenList2.AdditemTextEndIfNextEndSubZpqrḄ?Listl⌱Ḅᑡ⊤⚗ᑮList2:;ᑮ⚜3Ḅᦋ4ᑡᦋTUḄ?oLsit2.AdditemTextᦋList2.AddltemListl.List(i)5.ᨵ4ᦪFunctiondelspace(chAsString)AsIntegerDimn%,st$,c$//stn=0Fork=1ToLen(ch)c=Mid(ch,k,1)Ifc<>Thenst=st&cElsen=n+1EndIfNextkch=stdelspace=nEndFunctionᦪḄ?:ᑤ◀/01chḄ¢£0¤¥ᑤ◀/0Ḅ¦ᦪ6.4ᑡ¨Ḅ:©G18DimA(5,5)AsIntegerFori=1To3Forj=1To4A(i,j)=i*jNextjNextiPrintA(2,3)+A(3,4)+A(4,5)7.:4ᑡ¨®=©Go=┯Dima()AsInteger
1DimiAsIntegerReDima(10)Fori=1To10a(i)=2*i-1NextiPrinta(4);EraseaPrinta(4)8.ᨵ4OptionBase1PrivateSubCommand1Click()Dima(10)AsIntegerDimnAsIntegern=InputBox(®ᐭᦪ³)Ifn<10ThenCallGetArray(a,n)EndIfEndSubPrivateSubGetArray(b()AsInteger,nAsInteger)Dimc(10)AsIntegerJ=0Fori=1Tonb(i)=CInt(Rnd()*100)Ifb(i)/2=b(i)\2ThenJ=J+1c(j)=b(i)EndIfNextiPrintjEndSub·4¸¹┯ºḄ?oGetArrayrḄ»ᦪn?ᢥ¼〈Ḅ9.¿ᙠᵨḄ᪗ÂÃᙽ.XYÃᙽ'rSublḄ¸RÅᑖᑖᵨPublicGAsInteger"ஹ"PrivateGAsInteger'DimGAsInteger78¸RÆǦÈ\!"GGᙠrSublÉᵨ678G=3596ᑣ78?Êᙠ__________¸RÅᑖ)*Ḅ!"G6rSubl10.:78DimX,YAsIntegerÍx)*!YÎ,!"Y)*,!"11.XYZᨵ\]List1Ḅᑡ⊤᪾·ZÏᑡ⊤᪾ÐO⌱)Ḅᑡ⊤⚗Ñᣚ/01“Basic”Ḅ78?:List1.List(Listl.ListIndex)="Basic”12.VBÇÔᦻqÖ×ḄÎ,.ØஹÙÚஹÛᑴ13.ᙠ᪗ÂÃᙽa)*ᐰÞ,!"Ḅ78?:PrivateaAsInteger14.ᨵ¨4IFori=1To3Forj=5ToiStep-1Printi*j
2NextjNextiᐸ"Printi*j”78:Ḅßᦪ1215.4☢¨Ḅ:©G«á=DimsAsInteger,iAsIntegeri=1:s=1Doi=i+sLoopUntils>10Printi,s16.ᙠᦻã᪾Textl®ᐭᦪ/12,Text2®ᐭᦪ/34,:·478äᨵIText3.Text=val(Textl.Text)+val(Text2.Text)_åÉᦻã᪾Text3æç4617.Ꮇ)ᙠéᱏ᪾PicturelëᐭÆì¦éᱏᙠ:;Æí◀éᱏ(îï,í◀éᱏð?ᑤ◀éᱏ᪾)ñᵨḄTUò¹?o:78Picturel.PictureLoadPicture("")19.4☢ᐵôVBᦪ³ᦻqḄõ┯ºḄ?°VBᵨ÷ì¦ø⊤£Ḅᦪ³ùᐭᦻq20.⊤úRight("Beijing”,4)Ḅ?jing21.4ᑡ¸¹TUḄ?Ãᙽû!"åᙠÃᙽüᵨQR¨ᵨPrivate'Dim)*22.Ꮇ)ᙠXYZýþÆüᵨÿ ᪾ᐸCommonDialogl,ᵨ☢Ḅ ᪾:CommonDialogl.Action=2&'()Ḅ*oCommonDialogl.showsave23.1ᨵ45678PrivateSubCommandl_Click()Dimaa=Array(3,5,6,3,2,6,5,3,5,4,3,9,4,5,6,3,5)x=0n=UBound(A)Fori=0Tonm=0Forj=0TonIfa(i)=a(j)Thenm=m+1EndIfNextjIfm>xThenx=m:b=a(i)NextiPrintbEndSubVW7XYZḄ*324.[x*\]ᦪxḄ_3`aᦪbcdᐭḄ⊤gh0.01*Int(100*(x+0.005))25.W8A=Inputbox("Today","Tomorrow","Yesterday")nopYᐭ ᪾ᙠ ᪾ḄYᐭrsopḄtu*oYesterday26.ᐵwxᱏ᪾ஹx{᪾Ḅ|}s\~Ḅ*8xᱏ᪾6Printopᦻ
327.ᨵ☢Ḅ7X8x=InputBx(""Yᐭ""Yᐭ")Printx[W☢7XᨵYᐭᑁᢥᑣYZᑁ*__________Yᐭ28.FormlḄ¡ឋ*frm,£ḄLoad4567*Form_Load29.☢ᐵw᪗¦§ᙽḄ|}s┯ªḄ*᪗¦§ᙽsᒹ¬SubMain67®¯67°±²1³´µ6730.ᙠ☢Ḅ7Xs¶·nW____¸6Forv=20To10Step-2printvNextv31.ᙠ☢Ḅ7Xs¶·nW¸0Forv=10To20Step-2printvNextv32.ᨵCD1Ḅᵨ ᪾Command1Ḅº»ᢥ¼½¾Ḅ45678PrivateSubCommandlClickOCD1.Filter="AllFile|*.*|TextFileI*.txt|Word|*.Docz/CD1.Filterlndex=2CD1.FileName="E:\Test.ppt”CD1.InitDir="E:\"CD1.ShowOpenEndSubᐵw}7X|}\~Ḅ*oᢣÇḄÈÉÊË"E:\"33.ᐵwµᦪÍḄÎs°\~Ḅ*ÏᵨReDimᦋÒµᦪÍḄÓÔ34.ᙠVBsÖᦪ67&×7X67ḄrØÙ*Öᦪ67ᨵÚÛ,Ü×7X67ᨵ35.Ý⌕Ïᦻ᪾±ßYᐭàWᦻ¾'1³Ḅ¡ឋ*MultiLine36.ᙠᵨáᑴஹãäḄº»ᢥ¼ᦪÍᦪÍC1,ᐳᨵ3ᦪÍᐗç1FormlḄ᪗⚪"Myforml",ᡭêëṹíîᘤᑏëṹ8PrivateSubCIClick(IndexAsInteger)Forml.Caption="myform2”EndSubVWᓫòᢥ¼ᦪÍsḄ_óᢥ¼ᑣ᪗⚪myform237.Sub67&FunctionÖᦪᨬ᪷ḄrØ*—÷ὅùÚÛ®úὅᨵ38.Ýᙠ¾ᵨ7Xsᵨ"PrivateSubSubl(XAsInteger,YAsSingle)”Çü×7XSubl,ýᵨ×7XSublḄCalls*┯ªḄCallSubl(5)39.þÿᦻᐸᩩᵫᦪḄᦪ⚗ᡂᵨo40.!ᨵ#$%CombolḄᔠ᪾⌕-ᙠᐸ/012ᐭᦻ45ᢥ789:/01Ḅᦻ4;<=ᑮᑡ⊤B☢DEFGHDḄIoPrivateSubCombol_KeyDown(KeyCodeAsInteger,ShiftAsInteger)
4IfKeyCode=13ThenCombo1.AdditemCombo1.TextEndIfEndSub41.jkBlmᓫopqᢥr:2stuIo012345678910PrivateSubCommandl_Click()Dima(10)AsIntegerDimbFori=1To10a(i)=iNextiForEachbInaPrintb;NextbEndSub42.9!2ᐭᦪn,ᑨᦪIᔲIᐰᦪuᦪḄᡠᨵᦪᑣ$ᦪ%ᐰᦪPrivateSubCommandl_Click()DimnAsInteger,iAsIntegerDimsAsIntegernInputBox(2ᐭ⌕ᑨḄᦪ)i=1_____________s=lDoi=i+1IfnModi=0Thens=s+iLoopuntili=n-lIfThenPrintn;Iᐰᦪ[NY]s=nᡈn=sEndSub43.jB☢Ḅlm¢ᦻ4᪾Text1£¤ḄIo9DimiAsInteger,jAsIntegeri=1DoWhilei<20j=i+ji=i*(i+1)LoopTextl.Text=j44.©jB☢Ḅlm£¤tuIo45PrivateFunctiondigit(nAsInteger,kAsInteger)AsIntegerdigit=0DoWhilek>0digit=nMod10n=n\10:k=k-1Loop
5EndFunctionPrivateSubForm_Click()Printdigit(4567,4);Printdigit(4567,3)EndSub45.ᨵBlma=100Dos=s+aa=a+1LoopWhilea>120Printa©j:Ḅ2stu%10146.jBᑡlmᓫopqᢥrᙠ!2stu%563OptionBase1PrivateSubCommandl_Click()Dima(3,3)AsInteger,kAsIntegerDimiAsInteger,jAsInteger,nAsIntegernUBound(a,1)Fori=1Ton-2Forj=iTon-ia(i,j)=k+1a(j,n+1-i)=k+2a(n+1-i,n+l-j)=k+3a(n+1-j,i)=k+4k=k+4NextjNextiIfnMod200Thena((n+1)/2,(n+1)/2)=k+1EndIfPrinta(l,2);a(2,3);a(3,3)EndSub47.°ᙠ!ᨵᦻ4᪾Text1,᪗²ᦪLabel1,ᐳᨵ10᪗²kBlm¢EFᙠᓫo᪗²´µ᪗²Ḅᑁ·<=ᑮᦻ4᪾Fᨵᑁ·¸:PrivateSubLabell_Click(IndexAsInteger)Textl.Text=Textl.Text&________&EndSubLabel1(Index).captionᡈLabel1.(Index)49.ᦻtext.txtḄᑁ·%1,2,3jBᑡº»¼Open”text.txtForOutputAs#1Write#1,4,5,aaaClose#1ᑣtext.txtḄᑁ·%o4,5,“aaa”ᡈ4,5,“aaa”ᡈ4,5,“aaa”
650.©jBlm¢2stu%o16PrivateSubcommandl_click()a=1:b=2:c=3a=a+b:b=b+a:c=b+aIfa<>3Orb<>3Thena=b-a:b=c-a:c=b+aEndIfPrinta+b+cEndSub51.jB☢lmÀÁÂ2ᐭ10,20,30,40,50,60,ᑣ2stuI103050204060OptionBase1PrivateSubCommand1_Click()Dima(3,2)AsIntegerDimi%,j%,tFori=1To3Forj=1To2a(i,j)=InputBox(2ᐭᦪᐗÅḄÆ)NextjNextiForEachtInaPrintt;NexttEndSub52.°ᵨFunctiongcd(xAsInteger,yAsInteger)ÇÈÉ•-ËᦪḄᨬᜧÎÏᦪḄlmÐo´Dᙠ!£¤9664ḄᨬᜧÎÏᦪ⊡ᐙlmXGcd(a,b)FunctionGcd(xAsInteger,yAsInteger)'ÇÈÖᦪ-×ËᦪḄᨬᜧÎÏᦪDoWhiley<>0r=xModyx=yyrLoopGcdxEndFunctionPrivateSubFormClickODimaAsInteger,bAsIntegera=96:b=64'ØᵨÖᦪ-ËᦪḄᨬᜧÎÏᦪPrintGcdÙxEndSub53.VisualBasicÛÜ©ÝÞXor,Or,Not,AndßàᨬáḄ©ÝÞINot54.⊤âãXExp(3)—Sqr(a-2+b*2)ḄIᐵç⊤âã55.ᙠ!ᓫoè᪗´éᓽµPicture1£¤ᙠè᪗ëìB☢DEF!íîHDḄïðlI
7C.PrivateSubForm_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)Picturel.CurrentX=XPicturel.CurrentY=YEndSub56.-1!+2!+...+10!ḄlmB¼PrivateFunctions(xAsInteger)f=lFori=lToxf=f*iNexts=fEndFunctionPrivateSubCommandl_Click()DimiAsIntegerDimyAsLongFori=lTo10()NextPrintyEndSub%EFHD⌕-lmḄòóôᐭḄᑁ·IoB.y=y+s(i)57.ᨵB☢lmõṹ¼PrivateSubCommandl_Click()DimxAsInteger,sAsIntegerx=lFork=1To3x=x+lprocxs=s+xNextkPrintsEndSubPrivateSubproc(ByVaiaAsInteger)StaticxAsIntegerx=x+la=a+xEndSublm©j:ᓫopqᢥrCommand1,2stuI958.Bᑡlm¢Ḅjtu%oDimM(2)Fori=lTo2M(i)=0Nexti
8K=2Fori=lTokForj=lTOkM(j)=M(i)+lPrintM(k);NextjNextI022359.÷løᨵFormLForni2᪗ùúᙽModell,uᙠFormlᨵº»PublicXAsIntegerᙠMode11ᨵº»PublicYAsIntegerᑣkBüíýḄI¼ᙠFromlþkÿ ᵨX60.ᐵᦪḄ┯ḄᨵᦪᜐᳮḄ!"#$ᑮ&ᵨ'61.)*+,-ᘤḄ/0123᪾62.678ᨵ9:;<,LabellḄ᪗CD9:;<,TimerlḄIJᘤᐸEnabledOIntervalSឋᑖV,TrueO1000.XᑏF'1DimnAsIntegerPrivateSubTimerl_Timer()ch=chr(n+Asc("A"))Labell.Caption=chn=n+ln=nMod4EndSubno'ᙠ᪗Co)qᙢstuvwxAஹBஹCஹD,}~67ᐵ63.☢'noᓫcommandluv257PrivateSubcommandl_click()Fori=1To4Ifi>3ThenExitForNextiForj=1To6i=i+jNextjPrinti,jEndSub64.oaḄ,o32DimaAsIntegera=1Doa=a+2LoopWhilea=10065.ᑡᐵᓫ⚗Ḅ┯Ḅ1ᓫ⚗Ḅ166.SelectCase¡᪀£¤⚗*ᨵ¥¦§¨ᵨ©ªḄ—oCaseIs>x
967.,¬ᦻ®᪾ᐹᨵᚖ}±²ᩩ´ᐜ¶MultiLineSឋ·¸,True,ᯠº¶ScrollBarsSឋ·¸,268.\,/ஹMoDஹ*¿:ÀÁnÀxÂᐜÃᨬÅḄMod69.Ç9:¥È©ᦪNḄᓝÈᦪḄ©ªÊËn\10Mod1070.☢ᑡ⊤᪾SឋᦪÍḄoSelected71.678.ᨵ9:;<,VscrollḄᚖ}±²ᩩ⌕Ç'noJ±²ᙽḄÑȸᙠᨬÒ´ÓVScrolll.ValueḄÔVscrolll.Max72.ᑡ'ÕḄo¡Ö,o46Dima(10)AsInteger,b()AsIntegerDimiAsIntegerReDimb(5)Fori=1To10a(i)=iIfiMod2=0Thenb(i/2)=a(i)EndIfNextiPrinta(4);b(3)73no'ᓫÙÚᢥÜÖᵨᡝÞß8àᐭ6ஹ5ஹ4ஹ3ஹ2ஹ1,ᑣ678àãᑁ-,o9PrivateSubCommandlClick()Dima()AsIntegerDimiAsInteger,jAsIntegerReDinia(6)Fori=5To10a(10-i+1)=InputBox("inputnumber")NextiReDimPreservea(10)a(10)=a(5)+a(4)Printa(10)EndSub74.ᙠ&ᵨJᑡçË©ªḄ—oFunctionè*ᵨCall&ᵨ75.*éê30ë50(ì30O50)íîḄïðᦪḄ⊤ò¨_____Int(Rnd*21+30)76.ᨵ☢'óṹ1PrivateSubCommandl_Click()DimaAsStringa="COMPUTER”n=search(a,T)PrintHF(n=0,ùúᑮ,n)EndSubPrivateFunctionsearch(strAsString,chAsString)AsIntegerFork=lToLen(str)c=Mid(str,k,1)Ifc=chThen
10search=kExitFunctionEndIfNextksearch=0EndFunction'noᓫÙÚᢥÜCommandl,àã¡Ö677.û©ªḄïðᦻ0ü:ýþḄÿ Ḅ78.ᨵ☢ṹPrivateSubCommandl_Click()DimsignAsIntegerSign=la=lb=2Fork=lTo5c=a+sign*ba2bb=cPrintc;sign=-signNextkEndSub89:;ᓫ=>?ᢥACommandl,CDEF3-12-379.K9MNODimaAsInteger,PQaRSḄNOT;┯VḄ.oa=2*32760\380.Z[ḄMouseUp_`aPrivateSubFormMouseUp(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)EndSubᐵiPjM;PklmT┯VḄoMouseUpn᪗ᔣjqrstuḄ_`81.89☢;FCᐭ85,ᑣCDEFoi=3DimaAsInteger,iAsIntegera=InputBox("'inputa:)Ifa>60Theni=1Ifa>70Theni=2Ifa>80Theni=3Ifa>90Theni=4Printi=~i82Pᐵ⊤T;ᐸSTrueḄ;;VisualBasic/;O;;visualbasic;z83.⊤X>X+1oᐵ⊤84.ᑨ⌱᪾ᔲ⌱TḄឋValue85.ᦪInt(Rnd(0)*100)ᑡᑁḄᦪ[0,99]86.ᙠZ[j>?ᢥAᦻ¢᪾;ᐸ£¤ᑖ¦CommandlTextl,§ᦻ¢᪾
11ḄTextឋ¨©ª«;ᯠ:ᑏ_`aPrivateSubCommand1Click()A=Inputbox(;/EnterAnInteger")B=Inputbox("EnterAnInteger")Textl.Text=B+AEndSub89:;ᓫ=>?ᢥA;FᙠCᐭ¯°᪾Tᑖ¦Cᐭ456,ᑣᦻ¢᪾T±²Ḅᑁ³o56487.¨ᨵ´PrivateSubCommandl_Click()StaticaAsVarianta=Array(one,two,three,four,five)Printa(3)EndSub┐¯jm_`a;PlmT¸¹Ḅ—o»P¸¼89;ᙠZ[j±²four88.½qr¾`;¿À¨ᐸÁÂs;ឋÃÄrᦋÆTopLeft89.F⌕ᙠZ[jÉᵨ2Ëᓫ⌱ᢥA;ÌËÍ»Pᨵ•⌱T;ᑣÏÐÑḄᐜ2᪾Ó¾`ஹÕ§2Ëᓫ⌱ᢥAᑖ¦ᙠÖ×Ḅ᪾ÓT90.ᨵ☢ṹPrivateSubCommandl_Click()a=3s=0Fork=lTo5s=s+aModka2a+kNextkPrintsEndSub89:;ᓫ=>?ᢥACommandsCDEF491.¨ᨵᦪËØÙNOOptionBase1DimA(2To4,3)PjNOᡠMḄᦪËATᐳᨵᐗÝ992.NOPrintInt(Rnd*5+20)ḄCDÖ»Þ2593.¨ᨵ_`aPrivateSubCommandl_Click()Dimaa=Array(12,3,8,5,10,3,5,9,2,4)Fork=1To9Printfun(a(k-1),a(k));~NextkEndSubPrivateFunctionfun(x,y)AsIntegerDoWhilex>=y
12x=x-yLoopfun=xEndFunction89sCDḄEF03351351294.PMᦪËḄNO┯VḄDima(n)AsInteger95.PᐵiᦪaḄlmT;¸¹ḄoᦪaàáḄâãäᦪåæSḄâãçᨵᐵ96.VBT»PÉᵨÄèMḄSubaFunctiona;a¤ᦪ;éêa»PåæSFunction97.☢ᐵiëᦻ`Ḅìm¸¹ḄᦪíîÞPASCIIṹàïðᙠᦻ`T;ᡠP»ñaᦻ¢òó`±²98.☢ᓫô õã(ᓽᓫô ÷øã)ÆùḄox!99.ᙠᦻ¢᪾TextlTCᐭûüý;ᢥPþᑣÿ ṹᙠA-Z-A✌Ḅ⊤ᔣ6ṹᙠᦻ!᪾Text2()*ṹ+-+“ABCXYZ67Ḅṹ+GHIDEFAsc(ch)+6[NY]str2+chr(n-26)PrivateSubCommand1Click()DimstrlAsString,str2AsStringDimnAsInteger,chAsString*1,iAsIntegerstrl=UCase(Trim(Textl.Text))Fori=1ToLen(strl)ch=Mid(strl,i,1)Ifn<=90Thenstr2=str2+Chr(n)Elsestr2=___________EndIfNextiText2.Text=str2EndSub100.cde)ᐭ75,55,45,70,30,25,40,15,20,5,kᑡmnoḄ qc__330DimcAsInteger,kAsInteger,dAsIntegerc=70Fork=11To20x=InputBox()ᐭXḄᦪt)Ifx