06.08.2013 Views

03 林家民

03 林家民

03 林家民

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

題目說明:使用一為陣列來儲存某年度 1~12 月的手機費用<br />

檔案名稱:<strong>03</strong> \ ch7 \ P.222<br />

表單:<br />

程式碼:<br />

Private Sub Form_Activate()<br />

Dim bill(1 To 12) As Integer<br />

Dim i As Integer<br />

Dim sum As Integer<br />

For i = 1 To 12<br />

bill(i) = InputBox("請輸入" & i & "月的手機費:", "手機費輸入")<br />

sum = sum + bill(i)<br />

Next i<br />

MsgBox "今年度的手機費共繳了" & sum & "元", , "統計手機費"<br />

End Sub<br />

執行結果:ex.輸入 1~12 月每次 100

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!