系别:电子信息科学与技术 班级:电子2班 姓名:刘伟 日期:3月18号
学号:11050242018
一:试验目的
1 显示各位数
2 大小写转化
3 随机数
二:实验内容
1先界面设置和属性设置
2编写代码
1显示数:
Dim stuname as string
Dim Maths As Integer ,Eng AS integer , s Integer
Private Sub command1_Click
Stuname=InputBox
Maths= InputBox
Eng= InputBox
Compu = InputBox
Label1.Caption=StuName
Label1.Text = Maths
Label2. Text =,Eng
Label3. Text = Compu
Label4. Text = Maths +Eng+ Compu
Label5. Text = (Maths +Eng+ Compu)/3
End Sub
2大小写
Dim x as string
Private Sub form _load()
X=Text1.Text
End Sup
Private Sub command1_Click
Text1.Text=Ucase(x)
End Sup
Private Sub command2_Click
Text1.Text=Lcase(x)
End Sup
Private Sub command1_Click
Text1.Text=x
End Sup
3随机数
Private Sub command1_Click
Dim m as string
Dim n as string
M=Val(Text1.Text)
n=Val(Text1.Text)
Text3.Text=m+Int(Rnd*(n-m+1))
End Sup
三:心得体会
1随机数要用到Rnd(x)的函数
2 输入框为InpuBox
3转大写为Ucase,转小写为Lcase