题库 高中信息

题干

(加试题)数字个数统计。编写VB程序,实现如下功能:在文本框Text1中输入仅由ASCII码字符组成的字符串(长度不超过100),单击“数字统计”按钮Command1,在列表框List1中输出字符串中包含的不同数字及其相应的个数,程序运行效果如下图所示。

(1)为方便调试,要让程序每次运行时文本框Text1中的初始内容为“ab12*{}78ab12()778ab34”,应修改文本框Text1的________属性。
(2)实现上述功能的VB程序如下,请在划线处填入合适代码。
Private sub command1_click()
Dim a(0 to 9) as integer   ’数组元素a(i)中存放数字i的个数
Dim s as string , ch as string
Dim t as integer
For i=0 to 9
a(i)=0
next i
s=text1.text
for i=1 to len(s)
①____________    
if ch>=”0”and ch<=”9” then
t= ②________
a(t)= a(t)+1
end if
next i
list1.clear
for i=1 to 9
if  a(i)<>0   then
list1.additem  ”数字:”+str(i)+ ”,共有”+ str(a(i))+ ”个”
end if
next i
end sub
(3)与上述程序中加框处代码运行效果等价的条件表达式可以是________。
上一题 下一题 0.99难度 填空题 更新时间:2019-04-08 05:29:55

答案(点此获取答案解析)