资源描述:
《vb语言程序设计课后编程及上机调试参考答案》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、VB语言程序设计课后编程及上机调试参考答案ex0101PrivateSubLabel1_Click()Caption="练习"Command1.Caption="确定"Label1.FontBold=TrueLabel1.AutoSize=TrueLabel1.Caption="VisualBasic程序设计教程"EndSubex0102PrivateSubCommand1_Click()Txt.Text="我有电脑"EndSubPrivateSubCommand2_Click()Txt.Text="我没有电脑"EndSubPrivateSubCommand3_Click()
2、Txt.Text=""'一对双撇号,中间不留空EndSubex0104PrivateSubCommand1_Click()DimxAsSinglex=Val(Text1.Text)Text2.Text=15*xEndSubex0202PrivateSubForm_Click()DimrAsSingle,sAsSingler=4.6s=3.14159*r^2Text1.Text="圆的面积为"&sEndSubex0204PrivateSubCommand1_Click()'"最大化"按钮Form1.WindowState=2'最大化EndSubPrivateSubCommand
3、2_Click()'"还原"按钮Form1.WindowState=0'还原19EndSubPrivateSubCommand3_Click()'"最小化"按钮Form1.WindowState=1'最小化EndSubex0205PrivateSubcommand1_click()DimxAsSingleDimyAsSinglex=Val(Text1.Text)y=Val(Text2.Text)Text3.Text=x*x+y*yEndSubex0206PrivateSubcommand1_click()DimxAsStringx=Text1.TextText2.Text=L
4、eft(x,1)+Right(x,1)EndSubex0301PrivateSubForm_Load()DimxAsInteger,yAsIntegerDimaAsInteger,bAsInteger,cAsIntegerx=Val(InputBox("请输入一个三位数"))a=Int(x/100)'求百位数b=Int(x/10)-a*10'求十位数c=xMod10'求个位数Showy=c*100+b*10+a'生成倒序数Printx;"倒序数为:";y'显示倒序数EndSubex0302PrivateSubCommand1_Click()n=Val(Text1.Text)R
5、andomizex=Int(1+n*Rnd)Label1.Caption="第一个随机数"+Str(x)x=Int(1+n*Rnd)Label2.Caption="第二个随机数"+Str(x)x=Int(1+n*Rnd)Label3.Caption="第三个随机数"+Str(x)19EndSubex0303PrivateSubCmd1_Click()Lab1.Visible=TrueLab1.Caption="您已下达显示命令"EndSubPrivateSubForm_Click()Cmd1.Visible=TrueEndSubex0304PrivateSubForm_Key
6、Press(KeyAsciiAsInteger)ShowPrint"输入字符:";Chr(KeyAscii),"ASCII码为;";KeyAsciiEndSubPrivateSubForm_DblClick()ClsEndSubex0305PrivateSubForm_Load()x=MsgBox("在这里显示提示信息",4+0,"请确认")x=MsgBox("在这里显示"+Chr(13)+"提示信息",3+0,"请确认")x=MsgBox("在这里显示"+Chr(13)+"提示信息",2+16+0,"请确认")EndSubex0401PrivateSubForm_Load(
7、)DimxAsLong,sAsStringx=InputBox("输入一个整数(1~35000)")s="奇数"IfxMod2=0Thens="偶数"MsgBoxsEndSubex0402PrivateSubCommand1_Click()DimaAsSingle,bAsSingleDimcAsSingle,dAsSingleDimmAsSingle,nAsSingle,xAsSingleShowa=Val(Text1.Text)b=Val(Text2.Text)19c=Val(Text3.Text)d