有如下VB程序段,其程序功能为:在文本框Text1中输入一段仅由英文字母、标点符号和空格组成的句子(以“.”结尾),统计该句子中单词个数和单词的平均长度,程序界面如题图所示。
Dim s As String, ch As String
Dim i As Integer, cnt As Integer, sum As Integer, num As Integer
Dim ave As Single
s=Text1.Text:num=0:ch="":cnt=0:sum=0
For i =1 To len(s)
ch = Mid(s, i, 1)
If ⑴ Then
cnt=cnt+1
Else
If cnt>0 Then
num=num+1
⑵
⑶
End If
End If
Next i
ave=sum/num
Label1. Caption =“总共有”+ Str(num) +“个单词,平均长度为:”+ Str (ave)
划线处可选代码为:
①sum = sum + cnt
②sum = sum + num
③cnt = 0
④cnt = 1
⑤Not(ch =””Or ch = “.”)
⑥ch>=“a” And ch<=“z” or ch>=“A”And ch<=“Z”
⑴、⑵、⑶处语句分别为( )