x09818
|
分享:
▲
會有你想要的結果~ Public Class Form1 Dim a(100) As Integer Dim b(9) As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = "100組亂數:" & vbCrLf For i As Integer = 1 To 100 a(i) = Int(Rnd(10) * 10) If i = 1 Then Label1.Text &= a(i) Else Label1.Text &= ", " & a(i) End If Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click For i = 0 To 9 b(i) = 0 Next For i = 1 To 100 b(a(i)) += 1 Next Label2.Text = "統計結果:" & vbCrLf For i = 0 To 9 Label2.Text &= "數字為" & i & "的數量是" & b(i) & vbCrLf Next End Sub End Class
本帖包含附件 |
|
x09818.rar
(2022-06-09 14:13 / 9 KB) 說明: 執行檔 |
下載次數: | 13 |
[ 此文章被x09818在2009-12-11 12:26重新編輯 ]
此文章被評分,最近評分記錄財富:50 (by 三仙) | 理由: ^^ 因為您的參與,讓程式設計更容易!! | |
|
|
|