VB实验题Word文档格式.docx
- 文档编号:21278166
- 上传时间:2023-01-29
- 格式:DOCX
- 页数:53
- 大小:25.75KB
VB实验题Word文档格式.docx
《VB实验题Word文档格式.docx》由会员分享,可在线阅读,更多相关《VB实验题Word文档格式.docx(53页珍藏版)》请在冰豆网上搜索。
输入查找子串s6"
)
TextBox2.Text=InStr(TextBox1.Text,s6)
Label2.Text=Button6.Text&
"
函数的结果"
TextBox2.Text=UCase(TextBox1.Text)
Label2.Text=Button2.Text&
PrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.Click
TextBox2.Text=LCase(TextBox1.Text)
Label2.Text=Button3.Text&
TextBox2.Text=Len(TextBox1.Text)
Label2.Text=Button1.Text&
PrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.Click
TextBox2.Text=Trim(TextBox1.Text)
Label2.Text=Button4.Text&
PrivateSubButton5_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton5.Click
Dims5%
s5=InputBox("
输入产生字符的个数"
TextBox2.Text=StrDup(s5,TextBox1.Text)
PrivateSubButton7_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton7.Click
Dims7$
s7=InputBox("
输入替换字符串"
TextBox2.Text=Replace(TextBox1.Text,TextBox1.Text,s7)
Label2.Text=Button7.Text&
PrivateSubButton8_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton8.Click
Dims8%,s%
s8=Val(InputBox("
输入开始位数"
))
s=Val(InputBox("
输入结束位数"
TextBox2.Text=Mid(TextBox1.Text,s8,s)
Label2.Text=Button8.Text&
2.5
TextBox2.Text=Val(TextBox1.Text)
TextBox2.Text=Str(TextBox1.Text)
TextBox2.Text=Chr(TextBox1.Text)
TextBox2.Text=Asc(TextBox1.Text)
2.6
Dima,b,c,dAsInteger
Randomize()
a=Int(Rnd()*(999-100+1)+100)
TextBox1.Text=a
b=a\100
c=(aMod100)\10
d=aMod10
TextBox2.Text=d*100+c*10+b
实验三
3.1
DimxAsSingle
DimyAsSingle
x=Val(TextBox1.Text)
Ifx<
1000Then
y=x
ElseIfx>
=1000Andx<
2000Then
y=0.9*x
=2000Andx<
3000Then
y=0.8*x
Else
y=0.7*x
TextBox2.Text=y
3.2
DimtAsInteger
DimmoneyAsSingle
t=Val(TextBox1.Text)
Ift<
10Then
money=30
ElseIft>
=10Andt<
50Then
money=2.5*t
money=2*t
Ifmoney>
150Then
money=150
TextBox2.Text=money
3.3
DimaAsSingle
DimbAsSingle
DimcAsSingle
DimtAsSingle
DimmAsSingle
a=Val(TextBox1.Text)
b=Val(TextBox2.Text)
c=Val(TextBox3.Text)
Ifa<
bThen
t=a
a=b
b=t
cThen
a=c
c=t
Ifb<
m=b
b=c
c=m
TextBox4.Text=a&
>
&
b&
c
3.4
DimzAsSingle
y=Val(TextBox2.Text)
z=Val(TextBox3.Text)
Ifx>
yThen
t=x
x=y
y=t
zThen
x=z
z=t
Ify>
m=y
y=z
z=m
TextBox4.Text=x&
<
y&
z
3.5
PrivateSubTextBox2_LostFocus(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesTextBox2.LostFocus
DimmAsInteger
DimnAsInteger
m=Val(TextBox1.Text)
n=Val(TextBox2.Text)
IfnMod2<
0Then
MsgBox("
脚数必须为偶数"
,"
警告"
TextBox2.Text="
TextBox2.Focus()
ExitSub
y=n\2-m
x=m-y
0Ory<
荒唐解,请重新输入"
Label2.Text="
Label2.Text=x&
y
3.7
Dima!
b!
c!
d!
x1!
x2!
DimiAsInteger
d=b*b-4*a*c
Ifd<
i=MsgBox("
方程无实数根"
MsgBoxStyle.RetryCancel+48,"
Ifi=MsgBoxResult.CancelThen
Close()
x1=(-b+Sqrt(d))/(2*a)
x2=(-b-Sqrt(d))/(2*a)
x1="
x1
Label3.Text="
x2="
x2
End
3.8
'
Dimi!
'
Ifi=1Then
Label1.Text="
Monday"
ElseIfi=2Then
Tuesday"
ElseIfi=3Then
Wednesday"
ElseIfi=4Then
Thursday"
ElseIfi=5Then
Friday"
ElseIfi=6Then
Saturday"
Else
Sunday"
EndIf
DimiAsChar
SelectCasei
Case"
1"
2"
3"
4"
5"
6"
7"
EndSelect
DimcAsString
DimaAsInteger
c=Choose(a,"
"
Label1.Text=c
3.9
Dimx,yAsSingle,cAsString
IfRadioButton1.Checked()Then
y=Sin(x)
c=RadioButton1.Text&
("
x&
)="
ElseIfRadioButton2.Checked()Then
y=Exp(x)
c=RadioButton2.Text&
ElseIfRadioButton3.Checked()Then
y=Sqrt(x)
c=RadioButton3.Text&
Label2.Text=c
Private
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- VB 实验