欢迎来到天天文库
浏览记录
ID:35295366
大小:85.50 KB
页数:7页
时间:2019-03-23
《《vb程序设计教程》答案汇总》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、随机数产生PrivateSubForm_Click()Fori=101To200Step2Forj=2Toi-1IfiModj=0ThenExitForNextjIfj>=iThenList1.AddItemiNextiEndSub四实验21PrivateSubCommand1_Click()Fori=100To200Forj=10To14Ifi=j^2Thenn=n+1m=iEndIfNextjNextiText1=mText2=nEndSub4实验16PrivateSubForm_Click()
2、s=1Whiles<=100000i=i+1s=s*(2*i)WendPrint"s=";sEndSub4实验17PrivateSubForm_Click()DoWhileSum<=5000i=i+1Sum=Sum+i^iLoopPrint"sum=";Sum-i^iEndSub4实验23PrivateSubForm_Click()DimaAsInteger,bAsIntegera=Int(100*Rnd+1)b=Int(100*Rnd+1)Text1=aText2=br=aModbWhiler<>
3、0a=bb=rr=aModbWendText3=bc=(Val(Text1)*Val(Text2))/bText4=cEndSub6实验8PrivateSubForm_Click()RandomizeDima(8,8)AsIntegerFori=1To8Forj=1To8a(i,j)=Int((999-100+1)*Rnd+100)Printa(i,j);IfMax4、int"行号:";nPrint"列号:";mEndSub4实验24PrivateSubForm_Click()Fori=1To9Forj=1To9PrintTrim(i);"*";Trim(j);"=";Format(i*j,"!@@@");NextjPrintNextiEndSub4实验27PrivateSubCommand1_Click()DimaAsIntegerRandomizea=Int(101*Rnd+0)Text1.Text=aEndSubPrivateSubCommand2_Clic5、k()Fori=2Toa-1IfaModi=0ThenExitForNextiIfi>=a-1ThenText2.Text="是素数"ElseText2.Text="不是素数"EndIf5.6PrivateSubOption1_Click()Shape1.Shape=3EndSubPrivateSubOption2_Click()Shape1.Shape=1EndSubPrivateSubOption3_Click()Shape1.Shape=4EndSubPrivateSubOption4_Cli6、ck()Shape1.Shape=2EndSub5.9PrivateSubCommand1_Click()Fori=oToList1.ListCount-1IfList1.List(i)=Text1.TextThenExitForNextiIfi>=List1.ListCountThenList1.AddItemText1.TextEndIfText1.SetFocusText1.SelStart=0Text1.SelLength=Len(Text1)EndSubPrivateSubCommand27、_Click()IfList1.ListIndex=-1ThenMsgBox"请选择要删除的项"ElseList1.RemoveItemList1.ListIndexEndIfEndSubPrivateSubCommand3_Click()List1.ClearEndSub5.10PrivateSubCombo1_Click()SelectCaseCombo1.ListIndexCase0Text1.ForeColor=vbWhiteCase1Text1.ForeColor=vbBlackCase28、Text1.ForeColor=vbRedCase3Text1.ForeColor=vbGreenCase4Text1.ForeColor=vbBlueCase5Text1.ForeColor=vbYellowEndSelectEndSubPrivateSubCombo2_Click()SelectCaseCombo2.ListIndexCase0Text1.BackColor=vbWhiteCase1Text1.BackColor=vbBlackCase2Text1
4、int"行号:";nPrint"列号:";mEndSub4实验24PrivateSubForm_Click()Fori=1To9Forj=1To9PrintTrim(i);"*";Trim(j);"=";Format(i*j,"!@@@");NextjPrintNextiEndSub4实验27PrivateSubCommand1_Click()DimaAsIntegerRandomizea=Int(101*Rnd+0)Text1.Text=aEndSubPrivateSubCommand2_Clic
5、k()Fori=2Toa-1IfaModi=0ThenExitForNextiIfi>=a-1ThenText2.Text="是素数"ElseText2.Text="不是素数"EndIf5.6PrivateSubOption1_Click()Shape1.Shape=3EndSubPrivateSubOption2_Click()Shape1.Shape=1EndSubPrivateSubOption3_Click()Shape1.Shape=4EndSubPrivateSubOption4_Cli
6、ck()Shape1.Shape=2EndSub5.9PrivateSubCommand1_Click()Fori=oToList1.ListCount-1IfList1.List(i)=Text1.TextThenExitForNextiIfi>=List1.ListCountThenList1.AddItemText1.TextEndIfText1.SetFocusText1.SelStart=0Text1.SelLength=Len(Text1)EndSubPrivateSubCommand2
7、_Click()IfList1.ListIndex=-1ThenMsgBox"请选择要删除的项"ElseList1.RemoveItemList1.ListIndexEndIfEndSubPrivateSubCommand3_Click()List1.ClearEndSub5.10PrivateSubCombo1_Click()SelectCaseCombo1.ListIndexCase0Text1.ForeColor=vbWhiteCase1Text1.ForeColor=vbBlackCase2
8、Text1.ForeColor=vbRedCase3Text1.ForeColor=vbGreenCase4Text1.ForeColor=vbBlueCase5Text1.ForeColor=vbYellowEndSelectEndSubPrivateSubCombo2_Click()SelectCaseCombo2.ListIndexCase0Text1.BackColor=vbWhiteCase1Text1.BackColor=vbBlackCase2Text1
此文档下载收益归作者所有