实验一
dim a(20) as interger,s(10) as interger
private sub button1_click(.....)handles button1.click dim i%,j%
<=""
for i=1 to 20
a(i)=int(rnd*101)
<&=a(i)&space(6-len(a(i)))
j=a(i)\10
select casej
case 0to 5
s(5)=s(5)+1
case 9to 10
s(9)=s(9)+1
case 6to 8
s(j)=s(j)+1
end select
next i
end sub
private sub button2_click(...)handles button2.="0-59:"&s(5)&vbcrlf
<="60-69:"&s(6)&vbcrlf
<="70-79:"&s(7)&vbcrlf
<="80-89:"&s(8)&vbcrlf
<="90-100:"&s(9)&vbcrlf
buton1
dim lamp(100)
dim i%,j%,n%
n=)
for i=1to n
lamp(i)=0
next
for i=2 to n
for j=i to n
if j mod i=0 then
if lamp(j)=1 then lamp(j)=0
else lamp(j)=1
end if
end if
next
next
输出
for j=1 to n
if lamp(j)=1 then
<+="第"&s+r(j)&"盏灯亮"&vbnewline
end if
next
end sub
textbox1.
if not )or )<=0 then
msgbox("请输入正整数")
<=""
end if
end sub
实验二
SY2.1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim f#, c#
c = Val(TextBox2.Text)
f = (9 / 5) * c + 32
TextBox1.Text = Format(f, "#.##")
End Sub
Sy2.2
Public Class Form1
Dim RMB As Integer
Dim Change, Dol As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
End
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
RMB = Val(TextBox1.Text)
Change = Val(TextBox2.Text)
Dol = RMB / Change
TextBox3.Text = Format(Dol, "#.##")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dol = Val(TextBox3.Text)
Change = Val(TextBox2.Text)
RMB = Dol * Change
简单的vb程序代码
TextBox1.Text = Format(RMB, "#")
End Sub
End Class
Sy2.3
Public Class Form1

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。