Dim score As Integer 23 88 77 35

  • Slides: 5
Download presentation

設定陣列元素的值 設定一維陣列元素的值(五筆資料) 方法一: Dim score() As Integer = {23, 88, 77, 35, 99, 66}

設定陣列元素的值 設定一維陣列元素的值(五筆資料) 方法一: Dim score() As Integer = {23, 88, 77, 35, 99, 66} 方法二: Dim score(5) As Integer score = {23, 88, 77, 35, 99, 66} 方法三: Dim score(5) As Integer For i = 0 To 4 score(i) = Input. Box("請輸入第" & i & "科成績") Next

顯示輸出結果的方式 顯示結果方法一 Label 1. Text = "" For i = 0 To 4 Label

顯示輸出結果的方式 顯示結果方法一 Label 1. Text = "" For i = 0 To 4 Label 1. Text &= "第" & i + 1 & "號" & score(i) & "分" & Control. Chars. Cr. Lf Next Label 1. Text &= "最高分為:" & max & Control. Chars. Cr. Lf 顯示結果方法二 For i = 0 To 4 Controls("Label" + (i + 1). To. String). Text = "第" & i + 1 & "號" & score(i) & "分" & vbcrlf Next Label 6. Text = "最高分為:" & max & Control. Chars. Cr. Lf ‘vbcrlf