欢迎来到天天文库
浏览记录
ID:50957495
大小:46.00 KB
页数:5页
时间:2020-03-16
《VisualBasic程序设计作业答案..doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、VisualBasic程序设计作业答案作业2一、选择题1.B2.C3.D4.B5.D6.A7.B8.C9.A10.D11.C12.B13.D14.C15.A16.B17.C18.B19.D20.B二、填空题1.下拉式菜单弹出式菜单2.打开另存为颜色字体打印3.文本框列表框4.OptionBase15.Call语句6.工程工程属性通用Form1.Show7.08.Sub过程的过程名不能返回值,而Function过程能通过过程名返回值9.窗体模块标准模块类模块10.移出内存无效状态11.(1)2*Cosa*Sina/(2*a)(2)Sqr(s*(s-a)*(s-b)*(s-c))(3)Si
2、n(45*3.14/180)12.(1)x>=1Andx<12(2)A+B>=COra-c<=c(3)a>0Andb>0Or(a<0Andb<0)13.False14.ForWhileDo15.3三、阅读下列程序,给出程序运行结果。1.程序运行后,单击窗体,输出结果为:5050。2.3.54.3.435.*************************四、程序设计题1.PrivateSubCommand1_Click()DimxAsSingle,yAsSinglex=Val(Text1.Text)Ifx<100Theny=xElseIfx<200Theny=9.5*xElseIfx<
3、300Theny=0.9*xElseIfx<500Theny=0.8*xElsey=0.7*xEndIfEndIfEndIfEndIfText2.Text=yEndSub2.PrivateSubForm_Load()DimxAsIntegerx=100DoUntilx>200IfxMod3<>0ThenText1.Text=Text1.Text&Str(x)&Chr(13)&Chr(10)EndIfx=x+1Loop5EndSub3.PrivateSubForm_Click()Print"*";Tab(9);3,Tab(18);6;Tab(27);9;Tab(36);12PrintFo
4、rI=15to18PrintI;Forj=3to12Step3PrintTab(3*j);j*I;NextjPrintNextIEndsub4.PrivateSubCommand1_Click()UnloadMeEndSubPrivateSubOption1_Click()Text1.Text=10*2EndSubPrivateSubOption2_Click()Text1.Text=10/2EndSubPrivateSubOption3_Click()Text1.Text=10+2EndSubPrivateSubOption4_Click()Text1.Text=10-2EndSub
5、5.PrivateFunctionDay(nAsInteger)SelectCasenCase0Day="星期日"&Chr(13)&"(Sunday)"Case15Day="星期一"&Chr(13)&"(Monday)"Case2Day="星期二"&Chr(13)&"(Tuesday)"Case3Day="星期三"&Chr(13)&"(Wednesday)"Case4Day="星期四"&Chr(13)&"(Thursday)"Case5Day="星期五"&Chr(13)&"(Friday)"Case6Day="星期六"&Chr(13)&"(Saturday)"EndSelectEndF
6、unctionPrivateSubText1_KeyPress(KeyAsciiAsInteger)DimnAsIntegern=Val(Text1.Text)IfKeyAscii=13ThenIfn>=0Andn<7ThenLabel1.Caption=Day(n)ElseMsgBox"请输入0~6之间的整数!"EndIfEndIfText1.SelStart=0Text1.SelLength=Len(Text1.Text)EndSub6.新建一个工程,在默认的窗体Form1上放置一个Picture控件,然后编写如下代码。PrivateSubPicture1_MouseDown(Bu
7、ttonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)IfButton=2ThenMsgBox"YoupressedrightButton"Picture1.MousePointer=vbArrowEndIfEndSubPrivateSubPicture1_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)Picture1.Mou
此文档下载收益归作者所有