vb 编程 高手 帮帮忙
Founded in 1993, Qingdao Success Foreign Language School has devoted itself to professional training for people from all walks of society across the country. The headquarters is located near TaiDong, one of the most prosperous commercial centers, where transportation is convenient. Our school has developed quickly through these years. Now we have 3 branch campuses in Qingdao ; we also have sub-branch schools in JiNan and Harbin with others being established.
We have various kinds of training courses including English, Japanese, Korean, French,
German, Spanish, Italian, Portuguese, Russian and so on.
We also provide people with professional and special training courses aiming at the Exam for Custom Declarer, Certified Management Accountant (CMA) and Institute of Management Accountants , IMA). Up to now, we have already trained more than 80,000 people who are now working competently in each field. Our popularity and reputation have deeply rooted in those who want to better themselves across the country.
上面这一段英文,要求出有多少个单词,找出最长的单词用text显示出来.求单词的平均长度,
答案:终于编出来了,真辛苦!
Dim A As String, B As String, C As String, R, i As Integer, J As Integer
A = "Founded in 1993, Qingdao Success Foreign Language School has devoted itself to professional training for people from all walks of society across the country. The headquarters is located near TaiDong, one of the most prosperous commercial centers, where transportation is convenient. Our school has developed quickly through these years. Now we have 3 branch campuses in Qingdao ; we also have sub-branch schools in JiNan and Harbin with others being established."
B = "We have various kinds of training courses including English, Japanese, Korean, French, German, Spanish, Italian, Portuguese, Russian and so on."
C = "We also provide people with professional and special training courses aiming at the Exam for Custom Declarer, Certified Management Accountant (CMA) and Institute of Management Accountants , IMA). Up to now, we have already trained more than 80,000 people who are now working competently in each field. Our popularity and reputation have deeply rooted in those who want to better themselves across the country."
A = A + B + C
For i = 1 To Len(A)
J = Asc(Mid(A, i, 1))
Select Case J
Case 48 To 57, 65 To 90, 97 To 122
Case Else
Mid(A, i, 1) = "-"
End Select
Next i
J = Len(A) - 1
For i = 1 To J
If Mid(A, i, 1) = "-" And Mid(A, i + 1, 1) = "-" Then
A = Left(A, i) + Right(A, J - i)
J = J - 1
i = i - 1
End If
Next i
A = Left(A, Len(A) - 1)
R = Split(A, "-")
B = R(0)
For i = 1 To UBound(R)
If Len(B) < Len(R(i)) Then B = R(i)
Next i
Text1.Text = "本文共" + Str(UBound(R) + 1) + "个单词。"
Text2.Text = "最长的单词是:" + B
Text3.Text = "平均长度:" + Str((Len(A) - UBound(R)) / (UBound(R) + 1))
上一个:怎么用VB读内存。
下一个:计算机vB中的二叉树