速寻一些简单的小制作,要有新意一点的,简单一点的,实用一点的。最好是有图片。
通用技术会考用的,多谢帮忙!!!
速寻一些简单的小制作,要有新意一点的,简单一点的,实用一点的。最好是有图片。
通用技术会考用的,多谢帮忙!!!
随机数排序
Dim a(10) As Integer
Dim s As String
Private Sub Command1_Click()
Dim i, j, min, t As Integer
For i = 1 To 9
min = i
For j = i + 1 To 10
If a(j) < a(min) Then min = j
Next j
t = a(i)
a(i) = a(min)
a(min) = t
Next i
s = ""
For i = 1 To 10
s = s & " " & a(i)
Next i
Lb2.Caption = s
End Sub
Private Sub Command2_Click()
Unload Form1
End Sub
Private Sub Command3_Click()
Randomize
For i = 1 To 10
a(i) = Int((100 * Rnd) + 1)
s = s & " " & a(i)
Next i
Lb1.Caption = s
End Sub
Private Sub Form_Load()
End Sub
----------------------------------------------------------------------------------------------------------
随机数 计算 (点击窗体开始 一下一次)
Private Sub Form_Click()
Randomize
Dim n, r, max, min, sum As Integer
Dim ave As Single
r = Int(Rnd * 100) + 1
max = r
min = r
n = 1
sum = r
Print Spc(2); r;
Do While n < 10
r = Int(Rnd * 100) + 1
If r > max Then
mas = r
ElseIf r < min Then
min = r
End If
sum = sum + r
Print Spc(2); r;
n = n + 1
Loop
ave = sum / n
Print
Print Spc(2); "最大值是:" & max
Print Spc(2); "最小值是:" & min
Print Spc(2); "平均值是:" & ave
End Sub
------------------------------------------------------------------------------------------
猜数字游戏
Dim x As Integer
Dim y As Integer
Dim s As Integer
Private Sub Label1_Click()
End Sub
Private Sub Cmd1_Click()
Lb1.Caption = "请输入100以内的整数"
Randomize
x = Int((100 * Rnd) + 1)
Text1.Enabled = True
Text1.SetFocus
Cmd1.Enabled = False
Cmd2.Enabled = True
s = 1
End Sub
Private Sub Cmd2_Click()
y = Text1.Text
If x < y Then
Lb1.Caption = y & "太大了,重新来。你以共猜" & s & "次"
s = s + 1
Text1.Text = ""
Text1.SetFocus
ElseIf x > y Then
Lb1.Caption = y & "太小了,重新来。你以共猜" & s & "次"
s = s + 1
Text1.Text = ""
Text1.SetFocus
Else
Lb1.Caption = y & "太棒了,你猜对了。你以共猜" & s & "次"
s = s + 1
Text1.Text = ""
Cmd1.Enabled = True
Cmd2.Enabled = False
End If
End Sub
Private Sub Cmd3_Click()
End
End Sub
Private Sub Form_Load()
Lb1.Caption = "点击“开始”键进行游戏"
Text1.Text = ""
Cmd1.Enabled = True
Cmd2.Enabled = False
End Sub