版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、VisualBasic試驗參考指導(dǎo)書程序代碼9-1OptionExplicitOptionBase1PrivateSubCommand1_Click(Dimx(10AsInteger,maxvAsInteger,minvAsIntegerDimiAsIntegerFori=1To10x(i=Int(90*Rnd+10Text1.Text=Text1&Str(x(iNextiCallmaxmin(x,maxv,minvText2.Text=maxvText3.Text=minvEndSubPrivateSubCommand2_Click(Text1.Text=Text2.Text=EndEndS
2、ubPrivateSubmaxmin(a(AsInteger,maxAsInteger,minAsIntegerDimiAsIntegermax=a(1:min=a(1Fori=LBound(a+1ToUBound(aIfa(imaxThenmax=a(iElseIfa(iminThenmin=a(iEndIfNextiEndSub9-2PrivateSubCommand1_Click(DimxAsLongx=Val(Text1.TextIfverify(xThenListl.AddItemxElseMsgBoxStr(x&不是自守數(shù)。,vbInformationEndIfEndSubPriv
3、ateSubCommand2_Click(Text1.Text=EndSubPrivateSubCommand3_Click(EndEndSubPrivateFunctionverify(xAsLongAsBooleanDimyAsLong,sAsIntegerverify=Falses=Len(CStr(xy=x*xIfx=Val(Right(CStr(y,sThenverify=TrueEndIf9-3OptionExplicitOptionBase1PrivateSubCommand1_Click(DimaAsInteger,bAsInteger,iAsIntegera=Val(Text
4、1.Text:b=Val(Text2.TextFori=aTobIfsx(i=TrueThenList1.AddItemi8EndIfNextiIfList1.ListCount=0ThenList1.AddItem無升序數(shù)EndSubPrivateSubCommand2_Click(Text1.Text=Text2.Text=List1.ClearEndEndSubPrivateFunctionsx(ByValnAsIntegerAsBooleanDima(AsInteger,kAsInteger,iAsIntegerDok=k+1ReDimPreservea(ka(k=nMod10n=n1
5、0LoopUntiln=a(iThenExitFunctionNextisx=TrueEndFunction9-4OptionExplicitPrivateSubCommand1_Click(Textl.Text=Text2.Text=Text3.Text=EndSubPrivateSubCommand2_Click(EndEndSubPrivateFunctioncommon(ByValaAsInteger,ByValbAsIntegerAsIntegerDimrAsIntegerDor=aModba=bb=rLoopWhiler0common=aEndFunctionPrivateSubO
6、ption1_Click(IndexAsIntegerDimaAsInteger,bAsIntegerDimmAsInteger,dAsIntegera=Textlb=Text2m=common(a,bIfIndex=0ThenText3=mElsed=a*b/mText3=dEndIfEndSub9-5OptionExplicitPrivateFunctionJudge(nAsIntegerAsBooleanDimiAsIntegerFori=2ToSqr(nIfnModi=0ThenExitFunctionNextiJudge=TrueDimxAsInteger,iAsIntegerx=T
7、extl.TextIfx=4ThenText2=2+2”Elsei=3DoWhileText2=IfJudge(iAndJudge(x-iThenText2=i&+&x-iElsei=i+2EndIfLoopEndIfEndSubPrivateSubCommand3_Click(EndEndSub9-6PrivateFunctionchange(sAsString,nAsIntegerAsStringDimiAsInteger,kAsInteger,sumAsIntegerDimpAsString*1,qAsIntegerk=0Fori=Len(CStr(Text2.TextTo1Step-1
8、p=Mid(CStr(Text2.Text,i,1Ifp=0Andp=Len(Text1.Textnx=Val(stEndFunction9-8PrivateSubCommand1_Click(DimnAsInteger,iAsInteger,sAsString,a(AsIntegerForn=153To9999Ifarm(n=TrueThenReDima(Len(CStr(na(i=Mid(CStr(n,i,1Nextis=Fori=1ToLen(CStr(n-1s=s&CStr(a(i&A&CStr(Len(CStr(n&+NextiList1.AddItemCStr(n&=&s&CStr
9、(a(i&A&CStr(Len(CStr(nEndIfNextnEndSubEndEndSubPrivateFunctionarm(nAsIntegerAsBooleanDima(AsInteger,iAsInteger,stAsString,sumAsIntegerarm=Falsest=CStr(nReDima(Len(stFori=1ToLen(sta(i=Mid(st,i,1sum=Val(a(iA(Len(st+sumNextiIfn=sumThenarm=TrueElseExitFunctionEndIfEndFunction9-9Dimsco(5AsSinglePrivateSu
10、bCommand1_Click(DimiAsIntegerFori=0To5sco(i=(Int(Rnd*61+40/10Text1(i.Text=sco(iNextiEndSubDimiAsInteger,sumAsInteger,minAsSingle,maxAsSingleCalla(min,maxNextiText7.Text=(sum-min-max/4EndSubPrivateSuba(minAsSingle,maxAsSingleDimiAsInteger,kAsIntegermax=sco(0:min=sco(0Fori=1To5Ifsco(imaxThenmax=sco(iE
11、lseIfsco(iminThenmin=sco(iEndIfNextiEndSubFori=0To5NextiText7.Text=PrivateSubCommand4_Click(EndEndSub9-10PrivateSubCommand1_Click(DimmaxAsLong,minAsLongCallat(max,minText2.Text=maxText3.Text=minEndSubPrivateSubCommand2_Click(Text1.Text=Text2.Text=Text3.Text=EndSubEndEndSubPrivateSubat(maxAsLong,minA
12、sLongDimsAsString,iAsInteger,a(AsInteger,kAsInteger,tempAsInteger,stAsString,st1AsStrings=CStr(Text1.TextReDima(Len(sFori=1ToLen(sk=k+1a(k=Val(Mid(s,i,1Nextimax=a(1:min=a(1Fori=1ToLen(sForj=1ToLen(sIfa(ia(jThentemp=a(ia(i=a(ja(j=tempEndIfNextjNextiIfa(1=0ThenFori=2ToLen(sIfa(i0ThenExitForNextitemp=a
13、(ia(i=a(1a(1=tempEndIfFori=1ToLen(sst=st&a(iNextimin=Val(stFori=1ToLen(sForj=1ToLen(sIfa(ia(jThentemp=a(ia(i=a(ja(j=tempNextjNextiFori=1ToLen(sst1=st1&a(iNextimax=Val(st1EndSub7-2OptionExplicitOptionBase1PrivateSubCommand1_Click(Dima(20AsInteger,iAsInteger,stAsStringDimmaxAsInteger,minAsInteger,maxp
14、AsInteger,minpAsIntegerFori=1To20a(i=Int(Rnd*(100-1+1+1st=st&Str(a(iIfiMod10=0Thenst=st&vbCrLfNextiTextl.Text=stmax=a(1:min=a(1maxp=1:minp=1Fori=2To20Ifa(imaxThenmax=a(imaxp=iElseIfa(iminThenmin=a(iminp=iEndIfNextiText2.Text=max&位置是&maxpText3.Text=min&位置是&minpEndSubPrivateSubCommand2_Click(Text1.Tex
15、t=Text2.Text=:Text3.Text=EndEndSub7-5PrivateSubcmdExit_Click(UnloadMeEndSubPrivateSubcmdJudge_Click(DimmAsInteger,iAsInteger,jAsInteger,sumAsIntegerDima(m=Text1.TextFori=1Tom/2IfmModi=0Thensum=sum+ij=j+1ReDimPreservea(ja(j=iEndIfNexti=iOHAUMdE一j0dEbbrE+=AH-=odUAUMdbCD一EM-=bad?-Epurlo)dU5H當(dāng)BbM1-JAUMd
16、*DpunDzsmoNxoi=PedEl-瓦CDuoAdoJI-dW9,zO:qI=成3AHpunsXsBJdb(DSBrnuoAdoA)x.2olbPuBEEOoq3Dimfn(AsInteger,iAsInteger,kAsIntegerDimjAsInteger,stAsStringFori=10To50k=0Forj=1Toi-1IfiModj=0Thenk=k+1ReDimPreservefn(kfn(k=jEndIfNextjIfUBound(fn=3Thenst=i&:Forj=1ToUBound(fn-1st=st&fn(j&,NextjList1.AddItemst&fn(j
17、EndIfPrivateSubCommand2_Click(Listl.ClearEndSub7-7PrivateSubCommand1_Click(Dimword(AsString,SAsStringDimnAsInteger,kAsInteger,maxwAsStringS=Text1.TextDon=InStr(S,”Ifn0Thenk=k+1ReDimPreserveword(kword(k=Left(S,n-1List1.AddItemword(kS=Right(S,Len(S-nEndIfLoopUntiln=0ReDimPreserveword(k+1word(k+1=Left(
18、S,Len(S-1Listl.AddItemword(k+1maxw=word(k+1Forn=2ToUBound(wordIfLen(word(nLen(maxwThenmaxw=word(nEndIfNextnText2.Text=maxwEndSubPrivateSubCommand2_Click(Text1.Text=Text2.Text=List1.ClearText1.SetFocusEndSubPrivateSubCommand3_Click(EndEndSub7-9OptionBase1PrivateSubCommand1_Click(DimrndArray(10AsIntegerDimiAsInteger,jAsInteger,tempAsIntegerRandomizePicture1.Print啪E序前:Fori=1To10rndArray(i=Int(90*Rnd+10Picture1.PrintrndArray(i;N
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024學(xué)校維修合同書
- 2024年度網(wǎng)站域名合作契約
- 新建住宅購買合同樣本
- 藥品銷售代理合同范例
- 高中生宿舍管理規(guī)定范本
- 建筑機(jī)械租賃合同簡易格式
- 2024年資產(chǎn)抵債協(xié)議書
- 房屋房基流轉(zhuǎn)協(xié)議書-合同范本
- 制造企業(yè)員工合同樣本
- 產(chǎn)品加工合同典范
- 第16講 國家出路的探索與挽救民族危亡的斗爭 課件高三統(tǒng)編版(2019)必修中外歷史綱要上一輪復(fù)習(xí)
- 機(jī)器學(xué)習(xí) 課件 第10、11章 人工神經(jīng)網(wǎng)絡(luò)、強(qiáng)化學(xué)習(xí)
- 北京市人民大學(xué)附屬中學(xué)2025屆高二生物第一學(xué)期期末學(xué)業(yè)水平測試試題含解析
- 書籍小兵張嘎課件
- 氫氣中鹵化物、甲酸的測定 離子色譜法-編制說明
- 2024秋期國家開放大學(xué)??啤稒C(jī)械制圖》一平臺在線形考(形成性任務(wù)四)試題及答案
- 2024年經(jīng)濟(jì)師考試-中級經(jīng)濟(jì)師考試近5年真題集錦(頻考類試題)帶答案
- 2024年黑龍江哈爾濱市通河縣所屬事業(yè)單位招聘74人(第二批)易考易錯模擬試題(共500題)試卷后附參考答案
- 私募基金管理人-廉潔從業(yè)管理準(zhǔn)則
- 房地產(chǎn)估價機(jī)構(gòu)內(nèi)部管理制度
- 藝術(shù)哲學(xué):美是如何誕生的學(xué)習(xí)通超星期末考試答案章節(jié)答案2024年
評論
0/150
提交評論