数学
用vb编写程序代码,题目是输入20个英文单词,统计期中以D字母(大小写均可)的单词有多少个?

2019-04-16

用vb编写程序代码,题目是输入20个英文单词,统计期中以D字母(大小写均可)的单词有多少个?
优质解答
以字母d开头?
Private Sub Command1_Click()
Dim Arr(19) As String
Dim sum As Integer
sum = 0
For i = 0 To 19
Do While Arr(i) = ""
Arr(i) = InputBox("请输入一个单词")
Loop
If Mid(Arr(i),1,1) = "D" Or Mid(Arr(i),1,1) = "d" Then
sum = sum + 1
End If
Next
Print "以字母d开头的单词有" & sum & "个."
End Sub
以字母d开头?
Private Sub Command1_Click()
Dim Arr(19) As String
Dim sum As Integer
sum = 0
For i = 0 To 19
Do While Arr(i) = ""
Arr(i) = InputBox("请输入一个单词")
Loop
If Mid(Arr(i),1,1) = "D" Or Mid(Arr(i),1,1) = "d" Then
sum = sum + 1
End If
Next
Print "以字母d开头的单词有" & sum & "个."
End Sub
相关标签: 编写 题目 英文单词 统计 字母 单词
相关问答