用VB编程,求输入的英语句子中单词的平均长度
问题描述:
用VB编程,求输入的英语句子中单词的平均长度
例如:句子 All things are difficult before they are easy.中单词的平均长度为4.75.
答
控件:1个文本框,1个按钮代码:Private Sub Command1_Click()a = Len(Text1.Text)b = 0For i = 1 To a If " " = Mid(Text1.Text,i,1) Then b = b + 1 '统计空格数 End If If "," = Mid(Text1.Text,i,1) Or "." = Mid...