您好,欢迎访问三七文档
当前位置:首页 > 研究报告 > 综合/其它 > vb程序设计教程第三版实验E
1PrivateSubForm_click()Dima(9)AsIntegers=0Max=30Min=100Fori=0To9Randomizea(i)=Int(Rnd*71+30)Ifa(i)MaxThenMax=a(i)Ifa(i)MinThenMin=a(i)s=s+a(i)Printa(i);NextiPrintPrintMax=;Max,Min=;Min,Avg=;s/10PrintEndSub2PrivateSubForm_click()Dima()a=Array(56,78,98,88,76,78)Fori=LBound(a)ToUBound(a)PrintString(Int(a(i)/5),);a(i)PrintNextiEndSub3OptionBase1Dima(20)AsIntegerPrivateSubCommand1_Click()Fori=1To20Randomizea(i)=Int(Rnd*101)Picture1.Printa(i);PrintIfiMod4=0ThenPicture1.PrintNextiEndSubPrivateSubCommand2_Click()Fori=1To20SelectCasea(i)Case0To59n=n+1Case60To69b=b+1Case70To79c=c+1Case80To89d=d+1EndSelectNextiPicture2.Print059;nPicture2.Print6069;bPicture2.Print7079;cPicture2.Print8089;dPicture2.Print90100;20-n-d-b-cEndSubPrivateSubForm_click()Dima(9)AsIntegerPrintTab(2);,Fori=0To9a(i)=Int(Rnd*90+10)Printa(i);NextiForn=0To8nmax=nForm=n+1To9Ifa(m)a(nmax)Thennmax=mNextmt=a(nmax):a(nmax)=a(n):a(n)=tNextnPrintPrintTab(2);,Fori=0To9Printa(i);NextiEndSubPrivateSubForm_click()Dima(9)AsIntegerPrintTab(2);,Fori=0To9a(i)=Int(Rnd*90+10)Printa(i);NextiForn=8To0Step-1Form=0TonIfa(m)a(m+1)Thent=a(m+1):a(m+1)=a(m):a(m)=tNextmNextnPrintPrintTab(2);,Fori=0To9Printa(i);NextiEndSub5DimA(3,3),B(3,3)AsIntegerPrivateSubCommand1_Click()Fori=0To3Forj=0To3RandomizeA(i,j)=Int(Rnd*90+10)Ifi=jThenPicture1.PrintTab(j*5);A(i,j);NextjNextiEndSubPrivateSubCommand2_Click()Fori=0To3Forj=0To3RandomizeB(i,j)=Int(Rnd*900+100)Ifj=iThenPicture2.PrintTab(6*j);B(i,j);NextjNextiEndSubPrivateSubCommand3_Click()Fori=0To3Forj=0To3Ifi=jThens=s+A(i,j):m=m+B(i,j)NextjNextiPicture3.PrintA;sPicture3.PrintB;mEndSub6PrivateSubPicture1_Click()Dima()n=Val(Text1)ReDima(1Ton,1Ton)Fori=1TonForj=1TonIfi=jOrj=1Thena(i,j)=1IfijAndi=3Andj1Thena(i,j)=a(i-1,j-1)+a(i-1,j)Ifi=jThenPicture1.PrintTab(4*j);a(i,j);NextjNextiEndSubPrivateSubForm_Load()List1.AddItemWebList1.AddItemList1.AddItemList1.AddItemList1.AddItemList1.AddItemC/C++List1.AddItemVBList1.AddItemList1.AddItemEndSubPrivateSubList1_Click()n=List1.ListIndexIfList2.ListCount=4ThenList2.AddItemList1.List(n)List1.RemoveItemnElsei=MsgBox(5,0+64,)EndIfEndSubPrivateSubList2_DblClick()n=List2.ListIndexList1.AddItemList2.List(n)List2.RemoveItemnEndSubPrivateSubCombo1_KeyPress(KeyAsciiAsInteger)IfKeyAscii=13ThenIfNotIsNumeric(Combo1.Text)OrMid(Combo1.Text,1,1)=.ThenMsgBox():Combo1.Text=ElseCombo1.AddItemCombo1.Text:Combo1.Text=EndIfEndIfEndSub'PrivateSubCombo1_KeyPress(KeyAsciiAsInteger)'SelectCaseKeyAscii'0'Case48To57,13'CaseElse'KeyAscii=0'EndSelect'IfKeyAscii=13ThenCombo1.AddItemCombo1.Text:Combo1.Text='EndSubPrivateSubCommand1_Click()n=Combo1.ListCountimin=0imax=n-1Fori=0Ton-1IfVal(Combo1.List(i))Val(Combo1.List(imin))Thenimin=iIfVal(Combo1.List(i))Val(Combo1.List(imax))Thenimax=iNextit=Combo1.List(imin):Combo1.List(imin)=Combo1.List(0):Combo1.List(0)=tm=Combo1.List(imax):Combo1.List(imax)=Combo1.List(n-1):Combo1.List(n-1)=mEndSubPrivateSubForm_Load()Dima()a=Array(23,345,9,33,98,123,77,44)Fori=0ToUBound(a)Combo1.AddItema(i)NextiEndSubPrivateTypeworkmanghAsLongnameAsString*5gzAsLongEndTypeDima(4)AsworkmanDimi%PrivateSubCommand1_Click()Ifi=5ThenMsgBox(5):Text1.Text=:Text2.Text=:Text3.Text=Text1.Locked=True:Text2.Locked=True:Text3.Locked=TrueElseIfText1=OrText2=OrText3=Thenn=MsgBox(,0+48,)IfText1=ThenText1.SetFocusIfText2=ThenText2.SetFocusIfText3=ThenText3.SetFocusElseWitha(i).gh=Val(Text1).name=Text2.gz=Val(Text3)EndWithText1=:Text2=:Text3=i=i+1EndIfEndIfEndSubPrivateSubCommand2_Click()DimtAsworkmanPicture1.ClsPicture1.AutoRedraw=TruePicture1.PrintTab(3);;Tab(12);;Tab(22);Forn=0Toi-2imax=nForm=n+1Toi-1Ifa(m).gza(imax).gzThenimax=mNextmt=a(n):a(n)=a(imax):a(imax)=tNextnFors=0Toi-1Witha(s)Picture1.PrintTab(2);.gh;Tab(11);.name;Tab(20);.gzEndWithNextsEndSub
本文标题:vb程序设计教程第三版实验E
链接地址:https://www.777doc.com/doc-8695592 .html