资源描述:
《visualbasic程序设计课后题答案》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、Vb课后题答案参考答案第1章概述第3章常用标准控件二.选择题:1.C2.B3.C.4.D5.B6.B7.A8.C9.B10.C11.C12.A13.C14.B15.D16.D17.C18.A19.D20.A21.B三.编程及上机调试:1.PrivateSubCheck1_Click()IfCheck1.Value=1ThenText1.FontBold=TrueElseText1.FontBold=FalseEndIfEndSubPrivateSubCheck2_Click()IfCheck2.Value=
2、1ThenText1.FontItalic=TrueElseText1.FontItalic=FalseEndIfEndSubPrivateSubCheck3_Click()IfCheck1.Value=1ThenText1.FontUnderline=TrueElseText1.FontUnderline=FalseEndIfEndSubPrivateSubCommand1_Click()Text1.Text=""EndSub2.PrivateSubCommand1_Click()Text2.Text=L
3、ist1.ListCountEndSubPrivateSubCommand2_Click()List1.AddItemText1.TextText1.Text=""EndSubPrivateSubCommand3_Click()DimiAsIntegeri=List1.ListIndexList1.RemoveItemiCommand3.Enabled=FalseText1.SetFocusText2.Text=List1.ListCountEndSubPrivateSubForm_Load()Comman
4、d3.Enabled=FalseEndSubPrivateSubList1_Click()Command3.Enabled=TrueEndSub第4章VB语言基础二.选择题:1.A2.D3.D.4.A5.A6.A7.C8.D9.C10.B11.A12.D13.C14.A15.A16.C17.D18.A19.B20.D21.C22.A23.B24.C25.C三.编程及上机调试:1.PrivateSubForm_Load()DimxAsInteger,sAsString,dAsIntegerRandomizex
5、=Int(Rnd*9000+1000)s=Trim(CStr(x))d=Val(Right(s,1)+Mid(s,3,1)+Mid(s,2,1)+Left(s,1))ShowPrint"产生的数;";x;"倒序数";dEndSub2.PrivateSubForm_KeyPress(KeyAsciiAsInteger)Print"输入字符:";Chr(KeyAscii),"ASCII码为:";KeyAsciiEndSubPrivateSubForm_DblClick()ClsEndSub3.PrivateSu
6、bForm_Click()MsgBox"在这里显示提示"&vbCrLf&"提示信息",2+16,"请确认"EndSub或PrivateSubForm_Click()MsgBox"在这里显示提示"+Chr(13)+"提示信息",vbAbortRetryIgnore_+vbCritical,"请确认"EndSub第5章程序控制结构二.单选题1.D2.C3.C.4.D.5.B6.C7.A8.A9.D10.C11.C12.C13.B14.B四.编程及上机调试1.PrivateSubForm_Click()DimxA
7、sInteger,yAsIntegerx=InputBox("请输入一个数值")Ifx>20Theny=x^2+3*x+2ElseIfx>=10Theny=Sqr(3*x)-2ElseIfx>0Theny=1/x+Abs(x)EndIfPrint"x=";x,"y=";yEndSub(2)SelectCase实现:PrivateSubForm_Click()DimxAsInteger,yAsIntegerx=InputBox("请输入一个数值")SelectCasexCaseIs>20y=x^2+3*x+2
8、Case10To20y=Sqr(3*x)-2CaseIs>0y=1/x+Abs(x)EndSelectPrint"x=";x,"y=";yEndSub2.PrivateSubForm_Click()DimaAsInteger,bAsInteger,cAsIntegerFori=100To999a=i100b=(i-a*100)10c=iMod10Ifa^3+b^3+c^3=iThenPrinti;k=k+1I