输入一行字符,分别统计其中各英文字母出现的个数。(不区分大小写) 5
展开全部
Private Sub Command1_Click()
Dim i As Integer, strTxt As String, abc(25) As Integer, bytAsc As Byte, strTemp As String
strTxt = UCase(Text1.Text)
For i = 1 To Len(strTxt)
bytAsc = Asc(Mid(strTxt, i, 1)) - 65
If bytAsc >= 0 And bytAsc <= 25 Then abc(bytAsc) = abc(bytAsc) + 1
Next
For i = 0 To 25
If abc(i) > 0 Then strTemp = strTemp & Chr(i + 65) & " 出现 " & abc(i) & " 次" & vbCrLf
Next
Text2.Text = strTemp
End Sub
Dim i As Integer, strTxt As String, abc(25) As Integer, bytAsc As Byte, strTemp As String
strTxt = UCase(Text1.Text)
For i = 1 To Len(strTxt)
bytAsc = Asc(Mid(strTxt, i, 1)) - 65
If bytAsc >= 0 And bytAsc <= 25 Then abc(bytAsc) = abc(bytAsc) + 1
Next
For i = 0 To 25
If abc(i) > 0 Then strTemp = strTemp & Chr(i + 65) & " 出现 " & abc(i) & " 次" & vbCrLf
Next
Text2.Text = strTemp
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询