他是說,有一「數學」陣列如以下程式,為了獎勵滿分的同學,老師決定為所有 100分的同學再加5分,請完成此一程式:
Dim 數學() = {90,58,41,100,59,28,100,0,100,41,91,0}謝謝囉!!
2006-02-21 19:50:46 · 4 個解答 · 發問者 Anonymous in 電腦與網際網路 ➔ 程式設計
怎麼沒辦法去執行
2006-02-24 12:55:07 · update #1
'Dim 數學() = {90,58,41,100,59,28,100,0,100,41,91,0}
'上面這個方式在vb陣列裡會發生錯誤 "陳述結尾"
Private Sub Form_Activate()
Dim math(12) As Integer
math(1) = 90: math(2) = 58: math(3) = 41: math(4) = 100
math(5) = 59: math(6) = 28: math(7) = 100: math(8) = 0: math(9) = 100
math(10) = 41: math(11) = 91: math(12) = 0
For i = 1 To 12
If math(i) = 100 Then '如果是滿分的
math(i) = math(i) + 5 '就讓他加5分
End If
Next
Print "加分之後的分數"
For i = 1 To 12 '輸出加分後的結果
Print math(i)
Next
End Sub
2006-02-21 18:17:33 · answer #1 · answered by trewgefe 2 · 0⤊ 0⤋
Private Sub Command1_Click()
Dim 數學
數學 = Array(90, 58, 41, 100, 59, 28, 100, 0, 100, 41, 91, 0)
數學 = Split(Replace(Join(數學), 100, 105))
End Sub
2006-02-23 22:42:26 · answer #2 · answered by W.J.S. 7 · 0⤊ 0⤋
改成此即可:
Dim 數學()
數學() = Array(90, 58, 41, 100, 59, 28, 100, 0, 100, 41, 91, 0)
2006-02-22 12:39:02 · answer #3 · answered by 世賢 7 · 0⤊ 0⤋
Dim 數學() = {90,58,41,100,59,28,100,0,100,41,91,0}
Dim i = 0
For i = 0 to 數學.ubound
if 數學(i) = 100 then
數學(i) = 數學(i) + 5
end if
Next
2006-02-21 07:10:58 · answer #4 · answered by 傳加之楓 4 · 0⤊ 0⤋