版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
程序調(diào)01PublicSubdalt!,a#,b#,c#InputBox("a")InputBox("InputBox("===adalt=b*程序調(diào)01PublicSubdalt!,a#,b#,c#InputBox("a")InputBox("InputBox("===adalt=b*b-4*a*if---- Format((-b+dalt)/2/a),"0.00"+/a,daltdalt)/+Chr(10)+Format((-belseif--- MsgBoxFormat(-b/2/a,"0.00")+Chr(13)+Chr(10)Format(-b/2/a,3MsgBoxFormat((-b+dalt)/2/a,"0.00")+"+i"+Chr(13)+Chr(10)+b-dalt)/2/a,"0.00")+"-i"EndEnd程序調(diào)試OptionExplicitPublicSub'例如:輸Iamagoodstudent.'要求輸IAmAGoodoldsenAsString,newsenAskAsString,lastcharAsInteger,iAsIntegeroldsenk1lastchar2Fori=1kchar3Iflastchar=""EndIfnewsen=Next=newsen&=Form1.Print"input:";oldsenForm1.Print"output:";lastchar2Fori=1kchar3Iflastchar=""EndIfnewsen=Next=newsen&=Form1.Print"input:";oldsenForm1.Print"output:";End程序調(diào)試PublicSubDimiAsInteger'******1Dimks0s2To/+For===11s'*******3i+kk=1/s=sNext"s=";程序調(diào)04OptionExplicitPublicSubsame()252562525DimiAsx1AsString,x2Asi=1To==-------1i3DimiAsx1AsString,x2Asi=1To==-------1i3EndIfNextEnd程序調(diào)試PublicSubarmstrongAsIntegeriAsIntegerhundredAsIntegeriAsInteger1To999hundred=----1---ten=Int((iMod100)\one2If---- Form1.Printi;"isarmstrongEndIfNextEnd程序調(diào)06PublicSubsum()DimfAsi1f=2f=f+sign/(i*(i+3NextForm1.Print"f=";End程序調(diào)07OptionExplicitPublicSubf=2f=f+sign/(i*(i+3NextForm1.Print"f=";End程序調(diào)07OptionExplicitPublicSubDimn%,i%,x%x=fori=6to---1----step----2---3NextForm1.PrintxEnd程序調(diào)試PublicSub'求出該數(shù)列的第17個(gè)數(shù)是多少ii=4==12===last_one+12Ifi=17Form1.Print"No:17=";End3LoopWhilethis_one<=100000000#Form1.Print"No:";------4------;===last_one+12Ifi=17Form1.Print"No:17=";End3LoopWhilethis_one<=100000000#Form1.Print"No:";------4------;"is>1E+8"End程序調(diào)試PublicSubDimstr1AslengthAsIntegersumAsInteger'查到的個(gè)數(shù)iAsIntegerstr1InputBox("請(qǐng)輸入一個(gè)字符串")length=----1----i=sum=DoWhilei<----2---If----3----="at"Thensum=sum+1Endi=i+If---- MsgBoxMsgBox&Str(sum)&EndIf程序調(diào)試OptionPublicSubmAsInteger,nAsIntegerPublicSubmAsInteger,nAsIntegeriAsIntegerdivAsIntegerm=Val(InputBox("m="))n=LoopWhile----1---mn2Ifn<mThendiv=nEndDoWhilemModdiv<>0OrnModdiv<>3Form1.Printm;n程序調(diào)11PublicSubWrap()lengthAsIntegerstr1AsStringstrleftAsStringstrrightAsStringkAsstr1InputBox('****錯(cuò)誤1*****length=Val(str1)k=1strleftLeft(str1,k'****錯(cuò)誤3*****strrightRight(str1,k)'從右邊起逐個(gè)取出一個(gè)字符'****錯(cuò)誤4****Ifstrleft=strrightThenExitDoEndk=k+/LoopWhilekstrrightRight(str1,k)'從右邊起逐個(gè)取出一個(gè)字符'****錯(cuò)誤4****Ifstrleft=strrightThenExitDoEndk=k+/LoopWhilek<=2str1Ifk>length/Form1.Printstr1&End程序調(diào)12OptionExplicitPublicSubDToB()iAsVal(InputBox("x="))Form1.PrintresTrim(Str(res))&-----2-----==3LoopWhile----4-----程序調(diào)試PublicSubDimRAsIntegerDimXAsDimtimesAsIntegerRInt(Rnd*100)11,100]times=1DimtimesAsIntegerRInt(Rnd*100)11,100]times=1SelectCaseXCaseForm1.PrintExitDoCaseIs<CaseElseEndtimestimes1'******2******LoopWhiletimes>5Iftimes>5ThenForm1.Print"猜數(shù)失敗,游戲結(jié)束!"'******錯(cuò)誤3******Form1.Print&Str(X)End程序調(diào)14PublicSubsiAsSingleAsInteger1i12s=s+2^3Form1.Print"s=";End程序調(diào)15OptionExplicitPublicSubfind()DimcountN%,=End程序調(diào)15OptionExplicitPublicSubfind()DimcountN%,=112Form1.PrintcountN=countN+1EndIf3End程序調(diào)16PublicSube()'e的計(jì)算公式為:e=1+1/1!+1/2!+…+1/n!。Dimn,term,0:term=1:t=nn=n+t=---1--term=---2----LoopWhilet>form1.print"e="&---3---End程序調(diào)17OptionExplicitPublicSubqiuN()DimxAsSingle,sAsSingle,nAsInteger,s1AsSingle,pAsx=1s=1:np=1s1=ss(n+1)*234form1.Print"TheEndofn";n,"s=";x=1s=1:np=1s1=ss(n+1)*234form1.Print"TheEndofn";n,"s=";程序調(diào)18PublicSubprt()'''''''''9iAsInteger,jAsFori=9To1Form1.PrintSpace(i);Forj=1To19-2*iNextjNextEndFunction程序調(diào)19PublicSub'''''''''1程序調(diào)19PublicSub'''''''''19iAsIntegerjAsstartAsiAs1ToIfi<=---1---inum=220*i-numj==10+19-2*To---2---Form1.PrintTab(start+j);---3---NextjNext程序調(diào)試PublicSubkAsIntegerAs==100To1jDoWhilek<=jAndIfiModk=234tt+EndIfNextForm1.Print"t=";AsIntegerAs==100To1jDoWhilek<=jAndIfiModk=234tt+EndIfNextForm1.Print"t=";End程序調(diào)21PublicSub'''Dimx(30)AssumAsInteger,aveAsIntegeriAsIntegercountAsIntegerFori=1Tox(i)=Int(Rnd*100)+1Nextisum=Fori=1Tosum1Nextave2Fori=1ToForm1.Printx(i);IfiMod5Nextave2Fori=1ToForm1.Printx(i);IfiMod5=0ThenForm1.PrintNextiForm1.PrintFori=1To30Ifx(i)>ave3Form1.Printx(i);If------4--------ThenForm1.PrintEndIfNextiForm1.Printcount;程序調(diào)22OptionExplicitPublicSubDimxAsa()AsiAsInteger,posAsIntegera(10)AsInteger=1ToFora(i)=Int(Rnd*100)+1NextiFori=1To10Form1.Printa(i);"Nextx==i=1ToIfx=a(i)1Nextx==i=1ToIfx=a(i)1EndIfNextIfpos<>0Fori=-----2------To3NextReDimPreservea(9)9Fori=1To9Form1.Printa(i);"";NextiMsgBox&Str(x)&EndIf程序調(diào)23PublicSubcountAsIntegerIAsInteger,nAsForI=1To10'*****錯(cuò)誤2*****n=Int(Rnd*90)a(I)=nForm1.PrintIfa(I)Mod2=0Thencount=count+1NextIEndSub程序調(diào)24PublicSubIfa(I)Mod2=0Thencount=count+1NextIEndSub程序調(diào)24PublicSub'再按照字符ASCII碼從小到大的順序?qū)⑦@些字符重新組成新的字符串。DimxAsStringyAsStringc()AsStringxkkiInteger'字符串長(zhǎng)度Integer,jAsIntegerAs1ReDimc(k)AsStringFori=1To2c(i)Nextk-Fori=1Forj3Ifc(i)>c(j)=EndIfNextNext==y=Fori=1Toy=yNextForm1.Printy=Fori=1Toy=yNextForm1.PrintEnd程序調(diào)25PublicSubConstn=20i,p,j,ToDimFori=a(i)=----1---NextForip=1Ton-ij=iToIfa(p)<a(j)Then----2---NextIf----3----Thent=a(i):a(i)=a(p):a(p)=tNextiFori=2TonIfa(i)<>a(i-1)ThenForm1.Print----4---NextiEnd程序調(diào)26OptionExplicitPublicSub'''1121''''''1341014111561n61520=Dim+1)AsByte,iAsInteger,jAsDimsAsString'給數(shù)組aFori=1Ton+1a(i)=0Nexta(1)=1Form1.PrintSpace(2*nForm1.Printa(1)2);i=2To----1---a(i)=a(i-Forj=----2----To2Step-3NextForm1.PrintSpace((n-i+1)*Forj=1Tois=Trim(Str(----4---Form1.PrintSpace(Int((4/2+NextjLen(s))/2+0.5))+s+Space(Int((4NextEnd程序調(diào)試PublicSubDima(1To6,1To6)AsIntegerDimiAsInteger,jAsIntegerForm1.PrintFori=1ToForj=1Toa(i,j)=Int(Rnd*NextjNextiFori=2ToForj=1 Fori=1ToForj=1Toa(i,j)=Int(Rnd*NextjNextiFori=2ToForj=1 2NextiFori=1To6Forj=1To3NextjEndSubPublicSubSwap(aAsDimtempAsIntegertemp=aa=b=Endb程序調(diào)試PublicSuba(5,5)AsiAsInteger,jAsi=1ToForj=1To'********1Ifi<>jOri<>6-ja(i,j)=a(i,j)=1EndIf'********錯(cuò)誤2*********Form1.Printa(i,jSpace(3);NextForm1.Print:Nexta(i,j)=a(i,j)=1EndIf'********錯(cuò)誤2*********Form1.Printa(i,jSpace(3);NextForm1.Print:NextEnd程序調(diào)試PublicSubTo5,1To5)AsiAsInteger,jAsi1Toj=1If----51----2NextjNexti1Toj=15Form1.Print"Next3Next六、Sub程序調(diào)試PrivateConstn=10Privatea(1Ton)AsIntegerPublicSubDimt1i=1To2t=t*NextForm1.Print"T=";EndPublicSubPublicSubDimt1i=1To2t=t*NextForm1.Print"T=";EndPublicSubSCSJ()Form1.PrintiAsIntegerAs=1Toj=Int(Rnd*If------3-----ThenJ=-a(i)=j*Int(Rnd*(n+1))Form1.Printa(i);NextiEnd程序調(diào)試Dima(30)AsIntegerPublicSubPositionAsIntegermaxAsInteger'最大數(shù)iAsmax1Position=----2---Fori=2ToIfa(i)>maxmax3Position=----4---Nextimax3Position=----4---NextiForm1.Print"最大值="&Str(max)Form1.Print&Str(Position)EndPublicSubGenerateData()DimiAsIntegerFori=1Toa(i)=Int(500*Rnd()+Form1.PrintIfiMod5NextiEnd=0Then程序調(diào)試Dima(1To5,1Dimave(1To5)4)AsPublicSubDimiAsInteger,jAsInteger,tempAsIntegerDimLine_noAsInteger'最大平均值的行號(hào)Line_no=1Fori=2To'******1Ifave(Line_no)ave(i)Then'******錯(cuò)誤2*******Line_no=ave(i)NextiForj=1To4temp=a(1,j)a(Line_no,j)=a(1,a(Line_no,j)=tempNextjtemp=ave(1)ave(1)a(Line_no,j)=tempNextjtemp=ave(1)ave(1)ave(Line_no)ave(Line_no)=tempEndSubPublicSubDimiAsIntegerDimjAsInteger'產(chǎn)生5*4數(shù)組Fori=1To5Forj=1Toa(i,j)=Int(100NextjNextEnd*PublicSubiAsIntegerjAssumAsFori=sumForj=To0Tosum=a(i,j)Nextave(i)=sum/4NextiEndPublicSubiAsIntegerAs=1ToForj=1ToForm1.Printa(i,j);Spc(3);NextjEndPublicSubiAsIntegerAs=1ToForj=1ToForm1.Printa(i,j);Spc(3);NextjNextiEnd程序調(diào)試PublicSuba(10)AsiAsInteger,jAsIntegeri=1To10a(i)=Int(Rnd*21+NextFori=1To1Ifa(i)>a(j)2EndIfNextjNext3EndPublicSubSwap(aAsInteger,bAsDimtempAsIntegertemp=aa=b=End程序調(diào)試PrivateConstn=10Privatea(1b=End程序調(diào)試PrivateConstn=10Privatea(1Ton)AsInteger'BubbleSort過(guò)程是冒泡排序'Swap過(guò)程交換兩個(gè)變量數(shù)值PublicSubjAsDimiAsInteger,i=1Forj=i+1ToIfa(j)>a(i)ThenEndIfNexti=i+1'*******2*******LoopWhilei=nFori=1TonNextiEndPublicSubb=1To=DoWhileNota(i)=Int(20*b=TrueRnd'******3Forj=1ToIfa(i)=a(j)Thenb=FalseEndIfNextNextEnd'********錯(cuò)誤4********PublicSubIfa(i)=a(j)Thenb=FalseEndIfNextNextEnd'********錯(cuò)誤4********PublicSubSwap(ByValaAsDimtempAsIntegertemp=aa=b=EndByValbAs程序調(diào)35OptionExplicitPublicSubConstyear=2023If---- EndIfEndFunctionisLeapYear(yAsInteger)As2Or34)isLeapYear=isLeapYear=EndEnd程序調(diào)36PublicSubn=AssiAsEnd程序調(diào)36PublicSubn=AssiAs=1Tois=s1NextiEnd"s=";PublicFunctionnumber(2AsSinglen7所組成的數(shù)。DimkAsnumber=0Fork=1Ton3NextEnd程序調(diào)37PublicSubDims1AsString,s2Asadog,butitisnotagooddog!s1="itiss2="dog"EndFunctionmatchCount(str1AsString,str2AsString)AsIntegerstr2str1DimnumAsInteger,iAsInteger,posAsnum=Fori=1pos3Ifpos0'次數(shù)加1num=num1EndIfFori=1pos3Ifpos0'次數(shù)加1num=num1EndIfNextimatchCount=numEnd程序調(diào)試PublicFunctionnAsInteger)AsiAsIntegertempAsDouble1i=1Totemp=temp*NextnFactor=----2---EndPublicSubnsumAsDoubleiAsIntegernAsIntegeri=1Tosum=sum+----3---NextForm1.Print"sum="&----4---End程序調(diào)試39OptionExplicitPublicSubank,a,n,pAs=1Tok==For1p=Val(Mid(a,i,2iank,a,n,pAs=1Tok==For1p=Val(Mid(a,i,2i=kThenform1.PrintIfnNextEndFunctionfact(xAsInteger)AsyyAsLong=Fori%=1Toy=y*i%Nexti%3End程序調(diào)試PublicSubHexAsStringDecAsDoubleAs=n=Val(Hex)i=temptempMid(Hex,i,Dec=Dec+number(temp)*16^ii=i+1LoopWhilei<nForm1.PrintHexEndPublicFunctionnumber(strAsString)AsIntegerSelectCasestrCase"a",number=10Case"b","B"number=11Case"c","C"number=12Case"d","D"number=13Case"e","E"number=14Case"f","F"number=15CaseElsenumber=Val(str)EndSelectEnd程序調(diào)41PublicSubmAsInteger,nAsIntegeriAsIntegermultiAsIntegerm=Val(InputBox("m="))n=LoopWhile-----1-----multi2Form1.Printm;nmultiEndSubm=Val(InputBox("m="))n=LoopWhile-----1-----multi2Form1.Printm;nmultiEndSubPublicFunctionDiv(mAsInteger,nAsInteger)AsIntegerDimiAsmn3Ifn<mThenDiv=nEndDoWhilemModDiv<>0OrnModDiv<>4End程序調(diào)試PublicSubDimmAsnAsAsmnLoopWhilemnm>=n'******錯(cuò)誤1******CmnnFactor(m)nFactor(n)*nFactor(mn)Form1.Print"排列組合數(shù)為";CmnEndPublicFunctionnFactor(ByValnAsInteger)AsDimiAsIntegerDimtempAsDoubletemp=1Fori=1Tontemp=DimiAsIntegerDimtempAsDoubletemp=1Fori=1Tontemp=temp*iNext'******2******nFactor(n)=temp1:dalt>2:dalt=0MsgBoxFormat(-b/2/a,"0.00")+"+i"+Format(dalt/2/a,"0.00")++Chr(10)+Format(-b//a,"0.00")+"-i"+/2/題解021:3:kkAs=1To/i+改為:dimkas改為:forI=1to100step題解041:題解062:forI=2to題解062:forI=2to081:題解091:2:length3:1:m<=0or2:div=m3:div=div-11:length改為:lengthlen改為:strleftmid(str1,改為:strrightmid(str1,length+1-2:strleft3:strrightRight(str1,錯(cuò)誤4:Ifstrleft=strright 改為:Ifstrleft<>strright1:Decmod4:Dec>=1:CaseIs改為:CaseIs>2:LoopWhiletimes改為:Loop4:Dec>=1:CaseIs改為:CaseIs>2:LoopWhiletimes改為:LoopWhiletimes3:Form1.Print&&1:s=2:dowhiles<=1E+3:I=I+1題解152:(nmod3=1)and3:while5=1)and(n7161:1/(t*n2:
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 《美國(guó)的誕生》課件
- 《LA格式講座》課件
- 教培合同范本(2篇)
- 2024年度涉外離婚登記所需材料與程序詳解協(xié)議3篇
- 《地下水資源調(diào)查》課件
- 《知識(shí)產(chǎn)權(quán)常識(shí)》課件
- 2025年揚(yáng)州貨運(yùn)資格證考試有哪些項(xiàng)目
- 2025年安康貨運(yùn)從業(yè)資格證考試技巧
- 2025年蘭州從業(yè)資格證應(yīng)用能力考些啥
- 國(guó)際金融學(xué)課件匯率理論與學(xué)說(shuō)
- 2024年高考物理真題分類(lèi)匯編(全一本附答案)
- 精神科住院病人健康宣教
- 血透室護(hù)理安全防范
- 有限空間事故應(yīng)急預(yù)案演練記錄
- 電梯每日巡視檢查表
- 計(jì)算機(jī)科學(xué)與技術(shù)專(zhuān)業(yè)介紹
- 《幼兒教育學(xué)基礎(chǔ)》課件
- 迅雷網(wǎng)盤(pán)最最最全影視資源-持續(xù)更新7.26
- 購(gòu)置罐車(chē)可行性報(bào)告
- 臨床學(xué)科建設(shè)與發(fā)展規(guī)劃
- 外賣(mài)小哥培訓(xùn)道路安全管理
評(píng)論
0/150
提交評(píng)論