2009年2月27日 星期五

99-37

image 

'37.計算輸入英文文字檔案中,各「英文字」出現的次數。

Public Class Form1
       Dim i, a1, j
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        Dim b = "abcdefghijklmnopqrstuvwxyz"
        Dim c = " i Love You. "
        a1 = 0

          For j = 1 To 14
            If Mid(c, j, 1) = "o" Then a1 = a1 + 1
        Next
        MsgBox("o" & " 出現的次數: " & a1)
    End Sub
End Class

沒有留言:

張貼留言