(7) 已知b的ascii码为66,以下程序统计由键盘输入的字符串中各英文字母的使用次数
dim 【8】
for i=65 to 90
pp(i) =0
next
x$=inputbox("enter a string", x$)
x$=ucase$(x$)
for i=1 to 【9】
n=asc(mid$(x$, i, 1) )
if n >=65 and n <=90 then
【10】
end if
next i
for i=65 to 90
if pp(i) > 0 then
print chr$(i) ; pp(i)
end if
next
正确答案: 1.(pp(65 to 90)) 2.(len(x$)) 3.(pp(n) = pp(n)+ 1)
(8) 下面运行程序后,单击命令按钮,输出的结果是 【11】 。
private sub command1_click()
dim a%(1 to 4) , b%(3 to 6) , i%, s1#, s2#
for i=1 to 4
a(i) =i
next i
for i=3 to 6
b(i) =i
next i
s1=yas(a)
s2=yas(b)
print "s1="; s1; "s2="; s2
end sub
function yas(a() as integer)
dim t#, i%
t=1
for i=lbound(a) to ubound(a)
t=t * a(i)
next i
yas=t
end function
正确答案: 1.(s1=24 s2=360)
(9) 如果存在如下过程:
private function fmax(a() as integer)
dim first as integer, last as integer, i as integer
first=lbound(a)
last=ubound(a)
max=a(first)
for i=first to last
if a(i) > max then max=a(i)
next i
fmax=max
end function
在窗体上添加一个命令按钮,然后编写如下事件过程:
private sub command1_click()
redim m(1 to 4) as integer
m(1) =20: m(2) =30: m(3) =50: m(4) =100
c=fmax(m)
print c
end sub
单击命令按钮,其输出结果为 【12】 。
正确答案: 1.(100)
(10) 在窗体上加上一个文本框控件textbox,画一个命令按钮,当单击命令按钮的时候将显示"保存文件"对话框,设置该对话框可用于保存文本文件(默认) 和word文档,然后在文本框控件中显示保存的文件名,请填空。
private sub command1_click()
commondialog1.filter= 【13】
commondialog1.filter= 【14】
commondialog1.showsave
textbox.text= 【15】
end sub
正确答案: 1.("文本文件(*.txt) |*.txt|word文档|*.doc") 2.(1) 3.(commondialog1.)
本文共4页: 第
[1] [2] [3] [4] 页