vb课后习题答案华中科技大学独家doc.docx

上传人:b****3 文档编号:2971507 上传时间:2022-11-16 格式:DOCX 页数:18 大小:19.41KB
下载 相关 举报
vb课后习题答案华中科技大学独家doc.docx_第1页
第1页 / 共18页
vb课后习题答案华中科技大学独家doc.docx_第2页
第2页 / 共18页
vb课后习题答案华中科技大学独家doc.docx_第3页
第3页 / 共18页
vb课后习题答案华中科技大学独家doc.docx_第4页
第4页 / 共18页
vb课后习题答案华中科技大学独家doc.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

vb课后习题答案华中科技大学独家doc.docx

《vb课后习题答案华中科技大学独家doc.docx》由会员分享,可在线阅读,更多相关《vb课后习题答案华中科技大学独家doc.docx(18页珍藏版)》请在冰豆网上搜索。

vb课后习题答案华中科技大学独家doc.docx

vb课后习题答案华中科技大学独家doc

A5PrivateSubForml_Click(ByValsenderAsObject,ByVaieAsSystem.EventArgs)HandlesMe.Click

TextBoxi.Text=Val(TextBoxl.Text)+1

EndSub

BlModuleModulel

SubMain()

DimaAsBoolean

DimbAsBoolean

a=True

b=False

Console.WriteLine("{0}{1}{2}{3}","a",True,"b",False)

Console.WriteLine("{0}{1}{2}{3}{4}”,a,“AND”,b,”为a”,aAndb)

Console.WriteLine(n{0}{1}{2}{3}{4}{5}”,a,"AND",“Not”,b,”为a”,aAndNotb)

Console.WriteLine(n{0}{1}{2}{3}{4}{5}{6}”,a,b,"OR",b,”为an,a>bOrb)

Console.ReadLineQ

EndSub

EndModule

B2ModuleModule2

Submain()

DimxAsInteger

DimyAsInteger

Console.Write(,,lnputx=,,)

x=Console.ReadLine

Console.Write("lnputy=")

y=Console.ReadLine

Console.WriteLine("{0}{1}","表达式1的结果为。

Math.Sin(x)+

Math.Cos(y))

Console.WriteLine(,,{0}{l},,/”表达式2的结果为“,((x八2+y八2)/

Math.Abs(y))A(1/3))

Console.WriteLine(,,{0}{l}H,”表达式3的结果为“,x+y>xA2-10*x)

Console.ReadLine()

EndSub

EndModule

B3PrivateSubButtonl_Click(ByValsenderAsSystem.Object,ByVaieAsSystem.EventArgs)HandlesButtonl.Click

TextBoxi.Text=lnt(Rnd()*100+-49)

EndSub

PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByVaieAsSystem.EventArgs)HandlesButton2.Click

TextBoxi.Text=lnt(Rnd()*9998+1)*0.01EndSub

B4Randomize()

Labell.Text=lnt(Rnd()*9000+1000)Dima,b,c,dAsIntegera=Labell.Text\1000b=(Labell.TextMod1000)\100c=(Labell.TextMod(a*1000+b*100))\10d=(Labell.TextMod10)Label2.Text=c*1000+a*100+d*10+b

B5DimaAsDouble

a=TextBoxi.Text

Labell.Text=Format(a,"##,###.0000")Label2.Text=a

BIOTextBoxi.Text=UCase(TextBoxl.Text)

TextBoxl.Selectionstart=Len(TextBoxl.Text)

B6Dima=TextBoxl.Text

Labell.Text=Microsoft.VisualBasic.Left(a,16)

Label2.Text=Mid(a,17,6)

Label3.Text=Microsoft.VisualBasic.Right(a,5)

B7

Dima,bAsStringa=TextBoxl.Textb=TextBox2.TextLabell.Text=Replace(a,b,"")

B8PrivateSubButtonl_Click(ByValsenderAsSystem.Object,ByVaieAsSystem.EventArgs)HandlesButtonl.Click

DimF=VaI(TextBoxl.Text),C=VaI(TextBox2.Text)

C=(5/9)*(F-32)

TextBoxl.Text=Math.Round(C,2)

EndSub

PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByVaieAs

System.EventArgs)HandlesButton2.Click

DimF=VaI(TextBoxl.Text),C=VaI(TextBox2.Text)

F=(9/5)*C+32

TextBox2.Text=Math.Round(F,2)

EndSub

B9PrivateSubButtonl_Click(ByValsenderAsSystem.Object,ByVaieAsSystem.EventArgs)HandlesButtonl.Click

Dimp=3.14,a=Val(TextBoxl.Text)

TextBox2.Text=Format(p*a*a,"##.00")

EndSub

PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByVaieAs

System.EventArgs)HandlesButton2.Click

Dimp=3.14,a=Val(TextBoxl.Text)

TextBox3.Text=Format(2*p*a,"##.00")

EndSub

PrivateSubTextBoxl_KeyPress(ByValsenderAsObject,ByVaieAs

System.Windows.Forms.KeyPressEventArgs)HandlesTextBoxi.KeyPress

Ife.KeyChar=Chr(13)Then

IfIsNumeric(TextBoxl.Text)=FalseThen

MsgBox("输入非法字符,请重新输入",0,"友情提示")

TextBoxl.Text=""

TextBoxl.Focus()

EndIf

EndIf

EndSub

ClPrivateSubButton1_CIick(ByVaIsenderAsSystem.Object,ByVaieAs

System.EventArgs)HandlesButtonl.Click

Dimp=3.14,a=Val(TextBoxl.Text),b=VaI(TextBox2.Text)

TextBox2.Text=2*p*a

TextBox3.Text=p*a*a

IfIsNumeric(TextBoxl.Text)=FalseThen

MsgBox("输入值不合法")

EndIf

EndSub

C2Dimx,yAsSingle

x=lnputBox("输入x=")

Ifx>20Then

y=xA2+3*x+2

MsgBox("结果为"&y)

Elselfx<10Then

y=0.5+Math.Abs(x)

MsgBox("结果为"&y)

Else

y=(3*x)A0.5-2

MsgBox("结果为"&y)

EndIf

或者Dimx,yAsSingle

x=Val(TextBoxl.Text)

SelectCasex

CaseIs<10

y=0.5+Math.Abs(x)

MsgBox("结果为"&y)

CaseIs>20

y=xA2+3*x+2

MsgBox("结果为"&y)

CaseElse

y=(3*x)A0.5-2

MsgBox("结果为"&y)

EndSelect

C3Dima,b,cAsSingle

a=lnputBox("输入a:

")

b=lnputBox("输入b:

")

c=lnputBox("输入c:

")

Ifa+b>cAndb+c>aAnda+c>bThen

Ifa=bAndb=cThenMsgBox(”等边")

lfaA2+bA2=cA2OraA2+cA2=bA2OrbA2+cA2=aA2

ThenMsgBox(”直角“)

If(a=bXorb=c)Or(a=cXora=b)ThenMsgBox("等腰”)

EndIf

EndSub

C4Dima,b,cAsInteger

Randomize()

Labe11.Text=lnt(Rnd()*(900)+100)

a=Labell.Text\100

Labe12.Text=a

b=(Labell.TextMod100)\10

Label3.Text=b

c=Labell.TextMod10

Label4.Text=c

EndSub

C5Dima,b,cAsInteger

Randomize()

a=lnt(Rnd()*90+10)

b=lnt(Rnd()*90+10)

c=lnt(Rnd()*4+0)

SelectCasec

Case0

Labell.Text=a+b

Case1

Labell.Text=a*b

Case2

Labell.Text=a/b

Case3

Labell.Text=a-bEndSelect

C6

PrivateSubButtonl_Click(ByValsenderAsSystem.Object,ByVaieAsSystem.EventArgs)HandlesButtonl.Click

Dima,bAsSinglea=TextBoxl.TextIfa>5000Then

Label5.Text="八折":

Label6.Text=a*0.8

Elselfa>3000Then

Label5

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 法律文书 > 调解书

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1