欢迎来到天天文库
浏览记录
ID:50505395
大小:40.50 KB
页数:7页
时间:2020-03-10
《《VB程序设计教程》答案汇总.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、随机数产生PrivateSubForm_Click()Fori=101To200Step2Forj=2Toi-1IfiModj=0ThenExitForNextjIfj>=iThenList1.AddItemiNextiEndSub四实验21PrivateSubCommand1_Click()Fori=100To200Forj=10To14Ifi=j^2Thenn=n+1m=iEndIfNextjNextiText1=mText2=nEndSub4实验16PrivateSubForm_Click()s=1Wh
2、iles<=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<>0a=bb=rr=a
3、ModbWendText3=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、"列号:";mEndSub4实验24PrivateSubForm_Click()Fori=1To9Forj=1To9PrintTrim(i);"*";Trim(j);"=";Format(i*j,"!@@@");NextjPrintNextiEndSub4实验27PrivateSubCommand1_Click()DimaAsIntegerRandomizea=Int(101*Rnd+0)Text1.Text=aEndSubPrivateSubCommand2_Click()Fori=2Toa-1IfaMod5、i=0ThenExitForNextiIfi>=a-1ThenText2.Text="是素数"ElseText2.Text="不是素数"EndIf5.6PrivateSubOption1_Click()Shape1.Shape=3EndSubPrivateSubOption2_Click()Shape1.Shape=1EndSubPrivateSubOption3_Click()Shape1.Shape=4EndSubPrivateSubOption4_Click()Shape1.Shape=2EndSub56、.9PrivateSubCommand1_Click()Fori=oToList1.ListCount-1IfList1.List(i)=Text1.TextThenExitForNextiIfi>=List1.ListCountThenList1.AddItemText1.TextEndIfText1.SetFocusText1.SelStart=0Text1.SelLength=Len(Text1)EndSubPrivateSubCommand2_Click()IfList1.ListIndex=-1Th7、enMsgBox"请选择要删除的项"ElseList1.RemoveItemList1.ListIndexEndIfEndSubPrivateSubCommand3_Click()List1.ClearEndSub5.10PrivateSubCombo1_Click()SelectCaseCombo1.ListIndexCase0Text1.ForeColor=vbWhiteCase1Text1.ForeColor=vbBlackCase2Text1.ForeColor=vbRedCase3Text1.For8、eColor=vbGreenCase4Text1.ForeColor=vbBlueCase5Text1.ForeColor=vbYellowEndSelectEndSubPrivateSubCombo2_Click()SelectCaseCombo2.ListIndexCase0Text1.BackColor=vbWhiteCase1Text1.BackColor=vbBlackCase2Text1
4、"列号:";mEndSub4实验24PrivateSubForm_Click()Fori=1To9Forj=1To9PrintTrim(i);"*";Trim(j);"=";Format(i*j,"!@@@");NextjPrintNextiEndSub4实验27PrivateSubCommand1_Click()DimaAsIntegerRandomizea=Int(101*Rnd+0)Text1.Text=aEndSubPrivateSubCommand2_Click()Fori=2Toa-1IfaMod
5、i=0ThenExitForNextiIfi>=a-1ThenText2.Text="是素数"ElseText2.Text="不是素数"EndIf5.6PrivateSubOption1_Click()Shape1.Shape=3EndSubPrivateSubOption2_Click()Shape1.Shape=1EndSubPrivateSubOption3_Click()Shape1.Shape=4EndSubPrivateSubOption4_Click()Shape1.Shape=2EndSub5
6、.9PrivateSubCommand1_Click()Fori=oToList1.ListCount-1IfList1.List(i)=Text1.TextThenExitForNextiIfi>=List1.ListCountThenList1.AddItemText1.TextEndIfText1.SetFocusText1.SelStart=0Text1.SelLength=Len(Text1)EndSubPrivateSubCommand2_Click()IfList1.ListIndex=-1Th
7、enMsgBox"请选择要删除的项"ElseList1.RemoveItemList1.ListIndexEndIfEndSubPrivateSubCommand3_Click()List1.ClearEndSub5.10PrivateSubCombo1_Click()SelectCaseCombo1.ListIndexCase0Text1.ForeColor=vbWhiteCase1Text1.ForeColor=vbBlackCase2Text1.ForeColor=vbRedCase3Text1.For
8、eColor=vbGreenCase4Text1.ForeColor=vbBlueCase5Text1.ForeColor=vbYellowEndSelectEndSubPrivateSubCombo2_Click()SelectCaseCombo2.ListIndexCase0Text1.BackColor=vbWhiteCase1Text1.BackColor=vbBlackCase2Text1
此文档下载收益归作者所有