简单的VB问题
Option Base 1
Private Sub Command1_Click()
Dim alpha(26) As Integer,n As Integer
Dim i As Integer,s As String
Open "c:\kav2003\readme.txt " For Input As #11
Do While Not EOF(11)
s= Input(1,11)
s=UCase(s)
If s> = "A " And s <= "Z " Then
n= Asc(s)-64
alpha(n)=alpha(n)+1
End If
Loop
For i=1 To 26
If alpha(i) <> 0 Then
List1.AddItem Chr(i+64)& ": "&CStr(alpha(i))
End If
Next i
Close
End Sub
请问这个程序是怎么实现字符统计的
统计A~Z的字符个数
不是很明白 帮忙翻译下`
[解决办法]
将文本内容读到程序中,再逐一将每个字符分解为ascii码,最后利用循环将符合条件的进行累加。并显示在List1中。就这么简单。