(2)程序運(yùn)行時(shí),在Text1中輸入字符串,單擊“統(tǒng)計(jì)”按鈕,在List1中顯示統(tǒng)計(jì)結(jié)果.請(qǐng)?jiān)跈M線處填入合適代碼. ‘函數(shù)IsLetter(x)功能,若x是字母,則返回值為字母x在字母序列“A”~“Z”中的序號(hào),如字母“A”的序號(hào)為0,字母“D”的序號(hào)為3.若x不是字母,則返回值為-1. Function IsLetter(x As String) As Integer If“A“<=x And x<=“Z“Then IsLetter=Asc(x)-Asc(“A“) ElseIf“a“<=x And x<=“z“Then IsLetter=Asc(x)-Asc(“a“) Else
End If End Function Private Sub Command1_Click
Dim f(25)As Integer,m As Integer,n As Integer Dim s As String,c As String List1.Clear For m=0To 25‘初始化數(shù)組f f(m)=0 Next m s=Text1.Text For m=1To Len(s)‘依次讀取字符串中的每個(gè)字符進(jìn)行判斷 c=Mid(s,m,1) n=IsLetter(c) If n<>-1Then f(n)=f(n)+1 Next m For m=0To 25‘輸出統(tǒng)計(jì)結(jié)果,沒有出現(xiàn)的字母不輸出 If
Then List1.AddItem (Chr(m+Asc(“a“)) &“:“& f(m)) End If Next m End Sub.
Private Sub Command1_Click Dim t1As String,t2As Long,k As Integer For i=1To 10 k=i For j=i+1To n'n表示所有參與排序的會(huì)員人數(shù) If b(j)>b(k) Then k=j'① Next j If k<>i Then'② t1=a(i):a(i)=a(k):a(k)=t1 t2=b(i):b(i)=b(k):b(k)=t2 End If Next j Next i List2.AddItem“會(huì)員卡號(hào)“+““+“會(huì)員積分“
End Sub (1)如果要統(tǒng)計(jì)出積分最低的10名會(huì)員,只需在上述程序段中標(biāo)有①②的行中選擇一行進(jìn)行修改即可,那么應(yīng)該修改的代碼行為