程序阅读
题
快递公司问题件快递公司问题件货款处理关于圆的周长面积重点题型关于解方程组的题及答案关于南海问题
+填空题
许德武复习资料
一、 程序阅读题 a=a+x 1、 写出点击按钮command1后,显示在窗体上的内容。 x=x+3
private sub command1_click() Loop
dim k,j as integer End Sub
for k=1 to 5
4、 写出点击窗体后,显示在窗体上的内容。 print space(5-k);
for j=1 to k*2-1 Function chg(byval m as byte, n as byte) as byte
print chr(asc(“C”)+j); n=n+2
next j m=m+n
print Chg=2*m
next k End function
end sub Private sub form_click()
Dim k as byte , j as byte 2、 写出点击窗体后,显示在窗体上的内容。 j=1
Private sub form_click() For k=1 to 3
Call printdlt(5) Print k,j,
End sub Print chg(k,j)
Private Sub printdlt(n as integer) next k
Dim k as integer End sub
for k=1 to n
print space(n-k); 5、 写出单击窗体后,显示在窗体上的内容。
for j=1 to 2*k-1 Private Function chg(a As Integer,byval b as integer) As
print “*”; Integer
next j Dim n as integer
print b=b+1
next k For n=0 to 2
for k=1 to n-1 a=a+b
print space(k); Next n
for j=1 to 2*(n-k)-1 Chg=a
print “*”; End Function
next j Private Sub form_click()
print Dim a as integer,b as integer, z as integer
next k Dim n as integer
end sub a=1:b=1
for n=1 to 3 3、 写出程序运行时连续三次单击Command1后,a1.datz=chg(a,b)
文件的最终结果 print “n=”; n , ”z=”;z
Dim a As Integer, y As Integer next n
Private Sub Form_Load() End Sub
Open ”c:\al.dat” For Output As #1
6 Close #1 、 写出程序的执行结果
End Sub private sub form_click()
Private Sub Command1_Click() dim x as string
Open ”c:\a1.dat” For Append As #1 dim I as integer,n as integer
Call aa(5) x="ABCDEFG"
y=y+a n=len(x)
Print #1,”y=”; y, ”a=”; a : Close #1 For i=n to 1 step -2
End Sub x=x+mid(x,i,1)
Sub aa(i As Integer) Print mid(x,i,1);
x=1 Next i
Do until x>i Print
1
许德武复习资料
Print x 第三次输入3,第四次输入4,窗体上显示的结果。
Private Sub Form_Click() end sub
7、 写出点击三次窗体后,文件“a1.txt”中的内容。 Dim x As Integer Private Sub form_click() Static s As Integer
Static k As Integer x = Val(InputBox("请输入一个正整数=")) Dim j As Integer If x Mod 2 = 0 Then
k = k + 1 s = s * x
Open "c:\a1.txt" For Append As #1 Else
s = s + x For j = 1 To k
Print #1, j; End If
Next j Me.Print "s=" + Str(s)
End Sub Print #1,
Close #1
End Sub 11、写出单击窗体后,c:\data2.dat文件中的数据。
Private Sub Form_click()
8、 写出点击窗体后,文件”c:\result.txt”中的内容。 Open "c:\data1.dat" For Input As #1
Call outputdata("c:\data2.dat") Private sub form_click()
Dim s as string,k,j as integer, t as string Close
Dim a(1 to 5) as string End Sub
s=”basic” Private Sub outputdata(filename As String)
Dim a As String, b As Integer For k=1 to 5
a(k)=mid(s,k,1) Open filename For Output As #2 Next k Do While Not EOF(1)
Input #1, a, b Open “c:\result.txt” for output as 1
For k=1 to 4 If Left(a, 1) = "李" And b >= 60 Then
Print #2, a, b For j=k+1 to 5
If a(k)>a(j) then End If
t=a(k):a(k)=a(j):a(j)=t Loop
End if End Sub
Next j 已知在c:\data1.dat文件中数据如下:
Print #1,”a(”+trim(str(k))+”)=”; 张寇,78,李琳,80,王澜,56,司马,38,李晓,90,刘召,50,李
Write #1,a(k); 名,45
Next k
Print #1,”a(5)=”; 12、设输入的数据分别为14,3,125,21时,标签框Write #1,a(5) Label1.Caption的值分别是多少? Write #1,s Private Sub Form_ Click() Close 1 Dim a As Integer End sub a=Val (InputBox (“请输入数据”, 100))
Select Case a Mod 5
9、 写出单击窗体后程序的执行结果 Case Is <4 private sub form_click() w=a+10
for I=10 to 1 step –1 Case Is<2
print I;space(2); w=a*2
if I mod 3=0 then Case Else
print w=a-10
i=i-1 End Select
end if Label1.Caption=“w=”& Str(w) next i End Sub
end sub
13、写出a1.dat文件的最终结果
10、写出单击窗体四次,第一次输入1,第二次输入2,Private Sub Form_Click()
2
许德武复习资料
Dim f1 As Integer
16Dim f2 As Integer , f3 As Integer 、写出程序运行时单击窗体后,Form1上输出的结果
Open “c:\a1.dat” For Output As#1 Private Sub Form_Click()
f1=2 : f2=3 Cls
Print #1,”NO”;3,f1 For i = 1 To 8
Print #1,”NO”;4, f2 If i <= 2 Then
For i= 5 To 7 Print Tab(10); "VVV"
f3= f1+f2 Else
Print #1,”NO.”;I,f3 Print Tab(3 + i);
f1=f2 For j = 1 To 17 - 2 * i
f2=f3 Print "V";
Next I Next j
Close #1 Print
End Sub End If
Next i
14、写出运行以下程序后Form1上的输出结果 End Sub
写出将标记有?和?的两条语句对调后,重新运行
程序时Form1上的输出结果 17、写出程序执行的结果
Private Sub Command1_Click() Option Base 1
Const n=6 Private Sub Form_Click()
Dim xx(n) As Integer Dim a(5, 5) As Integer
Form1.Cls Dim i As Integer, j As Integer
For i=1 To n For i = 1 To 5
xx(i)=i*i For j = 1 To 5
Next i If j <= i Then
Call fchange(xx(),n) a(i, j) = 1
For i=1 To n End If
Form1.print xx(i), Print a(i, j); " ";
Next i Next j
End Sub print
Sub fchange(a() As Integer,m) Next i
For i=1 To m/2 End sub
t=a(i)
a(i)=a(m-i+1) „? 18、写出程序执行的结果
a(m-i+1)=t „? Private Sub form_click()
Next i Dim S As String
End Sub Dim k As Integer, n As Integer
S = "ABCDE"
15、程序运行时单击Command1后,分别写出文本框 n = Len(S)
Text1、Text2和Text3的Text值。 For k = n To 1 Step -1
Private Sub Command1_Click() S = S + Mid(S, k, 1)
n = 0: x = 1: y = 0 Print Tab(n - k + 1);
Do While x < 20 Print Mid(S, n - k + 1, 1)
n = n + 1 Next k
y=x+y Print Right(S, n)
x = x * (x + 1) End Sub
Loop
19、 写出往文本框顺序键入”H4E3”后,显示在窗体上的 Text1.Text = "n=" & Str(n)
Text2.Text = "x=" & Str(x) 内容。
Text3.Text = "y=" & Str(y) Private Sub Text1_Change() End Sub
Print Text1.Text
3
许德武复习资料
22、写出程序运行时单击窗体后窗体上的输出结果。 End Sub
Private Sub Form_Click() Private Sub Text1_KeyPress(KeyAscii As Integer) Dim a As Integer, b As Integer If KeyAscii >= Asc("0") And KeyAscii <= a=1
Asc("9") Then b=2
Print Chr(KeyAscii) + Text1.Text Call Proc1(a,b)
End If Print a,b
End Sub End Sub
Private Sub Proc1(c As Integer,d As Integer)
Dim a As Integer,b As Integer 20、控件HScroll1的属性设置如下:
c=a+b HScroll1.Min=1, HScroll1.Max=9, HScroll1.Value=1
d=a-b HScroll1.Smallchange=2, HScroll1.Largechange=4 Print c,d 下面程序运行时,4次单击滚动条右端箭头,写出各次单End Sub 击时Text1上的显示结果。 Dim y As Single 23、请写出程序的执行结果
Private Function f1(x2 As Integer) As Single dim a as integer,b as integer Static x1 As Integer dim n as integer,c as integer f1 = 0 a=12 : b=9 : c=11 For i% = x1 To x2 if a>b then n=b : b=a : a=n
f1 = f1 + i% if a>c then n=c : c=a : a=n Next i% if b>c then n=b : b=c : c=n x1 = i% print “a=”;a,”b=”;b,”c=”;c End Function 24、写出程序的执行结果
Private Sub HScroll1_Change() dim I as integer y = y + f1(HScroll1.Value) dim s as integer Text1.Text = y s=0
End Sub for I=-4 to 5
21、写出单击命令按钮Command1后窗体上的输出结果。 s=s+sgn(i)
Function F(a As Integer) as integer print sgn(i);space(2);
dim b as integer next
Static c as integer print
b = b + 1 print s
c = c + 1 25、写出程序的执行结果
F = a + b + c dim I as integer , j as integer
End Function for I=1 to 7
Private Sub Command1_Click() for j=1 to I*2-1 Dim a As Integer print chr(64+j); Dim b As Integer next j a = 2 print For i = 1 To 3
next I b = F(a)
26、写出程序的执行结果 Print b
Next i dim I as integer,j as integer
End Sub for I=1 to 5
for j=1 to I*2-1
print chr(asc(“D”)+i); next j
4
许德武复习资料
print next k
next i end sub
27、写出程序的执行结果 31、private static sub bbb() for I=10 to 1 step –1 dim a as integer,b as integer
print I;space(2); a=a+2
if I mod 3=0 then b=2*a
print print a;b end if end sub
next private sub form_click() 28、写出程序的执行结果 for I=1 to 3 sub exchange(a as integer,b as integer) call bbb
dim n as integer next
n=a : a=b : b=n end sub
end sub 请写出单击窗体后的执行效果。
、写出在窗体上单击三次的执行结果 private sub form_click() 32
dim I as integer , j as integer dim a as integer,y as integer
I=10:J=20 private sub form_click()
Print I;j call aa(5)
Call exchange(I,j) y=y+a
Print i;j print “y=”;y,”a=”;a end sub end sub
29、写出程序的执行结果 sub aa(I as integer) function chg(byval a as integer,b as integer) as x=1
integer do until x>I
b=b+1 a=a+x
x=x+3 a=a+b
chg=2*a loop
end sub end function
private sub form1_click() 33、请写出程序的执行后,文件中的内容
dim I as integer,j as integer,k as integer private sub form_click()
i=1:j=1 dim I as integer
for k=1 to 3 open “c:\a1.txt” for output as #1 print I;j; for I=1 to 5 print chg(I,j) print #1,“a(”+str(i)+”)=”; next k write #1,trim(str(I*i)) end sub next i
30、写出程序的执行结果 close #1
function chg(n as integer) as integer end sub
static m as integer
m=m+1
答案
八年级地理上册填图题岩土工程勘察试题省略号的作用及举例应急救援安全知识车间5s试题及答案
: chg=2*n+m
1、 end function
private sub form_click()
dim k as integer
for k=1 to 3
print k;chg(k)
5
许德武复习资料
D 9、 DEF 10 9 DEFGH 7 6 DEFGHIJ 4 3 DEFGHIJKL 1 2、
10、
*
*** s= 1
***** s= 2
******* s= 5
********* s= 20
*******
***** 11、
*** 李琳 80
* 李晓 90
3、
12、
y= 5 a= 5
结果分别是:w= 4 y= 15 a= 10
w= 13 w= 135 w= 31 y= 30 a= 15
13、 4、
NO 3 2 1 1 8
NO 4 3 2 3 14
NO. 5 5 3 5 20
NO. 6 8
5、 NO. 7 13
14、 n= 1 z= 7
n= 2 z= 13 交换前: n= 3 z= 19 36 25 16 9 4 1
交换后: 6、 1 4 9 9 4 1
GECA 15、 ABCDEFGGECA
n= 3
x= 42 7、
y= 9 1 1 2 16、 1 2 3
8、
6
a(1)="a",a(2)="b",a(3)="c",a(4)="i",a(5)="s"
"basic"
许德武复习资料
22、
VVV
0 0 VVV
0 0 VVVVVVVVVVV
VVVVVVVVV
VVVVVVV
VVVVV
VVV
V
17、
1 0 0 0 0
1 1 0 0 0
1 1 1 0 0
1 1 1 1 0 1 1 1 1 1
、(对齐稍有误差) 18
A
B
C
D
E
EDCBA
19、
H
4H
H4
H4E
3H4E
H4E3
20、
四次单击后的结果分别是:
6、15、28、45
21、
4
5
6
7
许德武复习资料
二、程序填空题
1. 随机生成10个二位整数,并按选择排序法从小到do
大的顺序进行排序。 n=______________’注意必须用val
函数
excel方差函数excelsd函数已知函数 2 f x m x mx m 2 1 4 2拉格朗日函数pdf函数公式下载
dim a(1 to 10) as integer, I as integer loop until abs(int(n))=n’什么意思, dim j as integer,ntemp as integer I=1
for i=1 to __ do while I<=int(sqr(n))
a(i)=______________ I=________ next If ________ then _______ for I=1 to 9 Loop
for j=___ to ____ If _______ then
if a(i)>a(j) then ___:_ :_____ Print _____+”是素数” next j Else
next i Print ______+”不是素数”
2. 随机生成10个10至50二位整数,并按从小到大End if
的顺序输入
dim a(1 to 10) as integer, I as integer 6. 判断一个随机得到两位整数是否是素数 dim j as integer, p as integer dim I as integer,n as integer
for i=1 to 10 n=___________
a(i)=__________ for I=2 to int(sqr(n)) next if n mod I=0 then ______ for I=1 to 9 next I
p=____ if _____ then
for j= print _____ +”不是素数”
if a(p)>a(j) then _____ else
next j print _____ +”是素数” if p<>i then end if
________:________:________
22227. 求最小的n,使得1end if +2+3„+n>100000 next i dim S as ______
随机生成10个50至99二位整数,并按冒泡法从dim n as integer 3.
n=1 小到大的顺序进行排序
S=1 dim a(1 to 10) as integer, I as integer dim j as integer, p as integer while ______ for i=1 to 10 n=_______
a(i)=______________ S=_______ next Wend
for I=1 to 9 Print n
for j=__ to __
8. 写一自定义函数,要求完成n!功能 if a(j)>a(j+1) then __________
next j function nfactor(n as integer) as long
next i dim I as integer
4. 交换A,B中的数据 dim sum as long
________ n=a :_____ :______
5. 判断一个数n是否为素数,数n由函数inputbox for I=1 to n 得到 sum=______
8
许德武复习资料
next delspc=temps
__________ End sub
sub function 13. 要求单击窗体后,在窗体上显示如下图形。补充
代码 1
9. 用递归方式实现n!的功能 private sub form_click 3 3 3 function nfactor(n as integer) as long dim I as integer,j as integer 5 5 5 5 5 if n=1 then for I=1 to 4 7 7 7 7 7 7 7
nfactor=___ print _____
else for j=1 to 2*I-1
nfactor=________ print _______ end if next j
end function _________
10. 编写一打印n行mystr字符串的过程 next i
sub printstr(n as integer,mystr as string) end sub
dim I as integer
for I=1 to ____ 14. 要求在窗体上以窗体中心为圆心,以窗体宽度1/4
__________ 为径画一红边黄圆。
next Private sub form_click end sub Dim x as integer,r as integer
11. 编写一个把字符串反转函数。如s=”12345”,反 Dim y as integer 转之后为“54321” X=____________ function invert(s as string) as string Y=____________
dim I as integer R=scalewidth/4
dim ns as string ___________
ns=”” fillcolor=_________
for I=1 to ___ circle ____________
ns=ns+________ End sub
next i 15. 单击按钮command1,把a1.txt中的内容原样显示
________ 在text1中。
end function Private sub command1_click
12. 下面的自定义函数delspc用来实现去除字符串中 Dim s as string 所有空格的功能。 _________________
Private Function delspc(s as string) as string while _________ Dim slen as integer , k as integer line input #1,s Dim temps as string ,t as string _______________ Dim lstr as string , rstr as string wend
Temps=s close #1
__________ End sub
for k=slen to 1 step -1 16. 下面程序是实现驱动器列
表
关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf
框drive1,目录列表
t=__________ 框dir1,文件列表框file1的联动。
if t=” ” then Private sub drive1_change
lstr=left(temps, k-1) ___________
rstr=mid(temps, k+1)’两个参数, End sub
temps=__________ Private sub dir1_change
end if ____________
next k End sub
9
许德武复习资料 17. 编写一个字符串反转函数invert,如b=”abcde”,则invert(b)等于”edcba”。
function invert(s as string) as string
dim k,slen as integer
dim newstr as string
newstr=””
_________
for k=slen to 1 step -1
newstr=newstr+__________
next k
__________
end function
18. 下面程序的功能是判断输入的正整数n是否为素数。
Private sub command1_click()
Dim k,n as integer
N=val(inputbox(“请输入正整数n”))
For k=2 to int(sqr(n))
If _________then exit for
Next k
If ________ then
Print str(n)+”是素数”
Else
Print str(n)+”不是素数”
End if
End sub
19. 程序的界面如图,现要求完成以下功能:1、当盘驱动器列表框drive1的当前盘符发生改变时,目录列表框
dir1显示相应驱动器的目录结构;2、当双击目录列表框的某个项目时,文件列表框file1显示该项目对应
文件夹中的文件。
Private sub dir1_change()
______________
End sub
Private sub drive1_change()
_______________
End sub
20. 程序完成在窗体上画一条对角线(从右上角至左下角),并在窗体中心画一个半径为窗体高度四分之一的红
色圆环。(该窗体的scaletop和scaleleft都为0)
Private sub form_click
Dim x1,y2,r as integer
x1=____________
y2=form1.scaleheight
r=y2/4
10
许德武复习资料
line (x1,0)-(0,y2)
_________________________
End sub
21. 随机生成10个10至50二位整数,并用选择法按从小到大的顺序排列。
Private sub form_click()
dim a(1 to 10) as integer, k as integer
dim j as integer, p as integer, n as integer
for k=1 to 10
a(k)=______
next k
for k=1 to 9
p=k
for j=______
if a(p)>a(j) then _____
next j
if p<>k then n=a(p):a(p)=a(k):a(k)=n
next k
end sub
22. 要求在窗体上以窗体中心为圆心,以窗体宽度1/4为直径画一红边实心黄圆。
Private sub form_click()
Dim x as integer,r as integer
Dim y as integer
x=scalewidth/2 : y=scaleheight/2
r=scalewidth/4
___________
fillcolor=rgb(255,255,0)
circle ____________
End sub
23. 下面的自定义函数delspc用来实现去除字符串中所有空格的功能。
Private function delspc(s as string) as string
Dim slen as integer , n as integer
Dim temps as string ,t as string * 1
Dim lstr as string , rstr as string
Temps=trim(s)
_________
for n=slen to 1 step -1
t=_________
If t=” ” then
lstr=left(temps, n-1)
rstr=mid(temps, n+1)
temps=lstr+rstr
end if
next k
__________
End function
24. 写一自定义函数,要求完成n!功能
function nfactor(n as integer) as long
dim I as integer
dim sum as long
________
for I=1 to n
11
许德武复习资料
sum=______
next i
__________
sub function
25. 单击按钮command1,把”c:\a1.txt”中的内容原样显示在文本框text1中。
Private sub command1_click
Dim s as string
___________
while _________
line input #1,s
____________
wend
close #1
End sub
26. 以下程序随机产生100个属于[3,1000]之间的整数,利用自定义函数Isprime(用于判断一个整数是否是素
数)挑出其中的素数放在b数组中,对这些素数按从大到小的顺序进行排序,最后按每行5个的格式输出这
些素数。
Private Sub Form_Click()
Dim a(100) As Integer
Dim b(100) As Integer
Dim i As Integer, j As Integer, n As Integer
For i = 1 To 100
a(i) = -------(1)-------
Next i
For i = 1 To 100
If Isprime(a(i)) Then
n = n + 1
b(n) = -------(2)-------
End If
Next i
For i = 1 To n - 1
For j = i + 1 To n
If b(i) < b(j) Then
swap -------(3)-------
End If
Next j
Next i
J = 1
For i = 1 To n
Print b(i); " ";
If -------(4)------- Then Print
j = j + 1
Next i
End Sub
Public Function Isprime(x as Integer) As Boolean
Dim i As Integer
Isprime = False
For i = 2 To int(sqr(x))
If x Mod i = 0 Then Exit For
Next i
12
许德武复习资料
If i > int(sqr(x)) Then
-------(5)-------
End If
End Function
Public Sub swap(a As Integer, b As Integer)
Dim temp As Integer
temp = a
a = b
b = temp
End Sub
27. 【程序说明】下列过程的功能是为与形参a所对应的n个元素的实参数组送数,第1个元素赋值为n,其他
元素为2位随机整数,要求这n个数各不相同。
【程序】
private sub create(a() as byte, n as byte)
dim I as byte, j as byte, x as byte
a(1)=n
I=1
Do while I
a(j) Then ( )
Next j
13
许德武复习资料
If ( ) Then t=a(i):a(i)=a(p):a(p)=t
Next i
For i=1 To n
Print a(i);
Next I
( )
( )
End Sub
Private Sub Cmdend_Click()
End
End Sub
29. 本程序求3—100之间的所有素数(质数)并统计个数;同时将这些素数从小到大依次写入顺序文件
e:\dataout.txt;素数的个数显示在窗体Form1上。
[程序]
Private Sub Command1_Click()
Dim count As Integer, flag As Boolean
Dim ti As Integer, t2 As Integer
(41)
count = 0
For t1 = 3 To 100
flag = True
For t2 = 2 To Int(Sqr(t1))
if (42) then flag=False
Next t2
(43)
count = count + 1
Write #1, t1
End If
Next t1
(44)
Close #1
End Sub
(41) A. Open e:\dataout.txt For Output As #1
B. Open "e:\dataout.txt" For Input As #1
C. Open "e:\dataout.txt" For Output As #2
D. Open "e:\dataout.txt" For Output As #1
(42) A. t2 \ t1 = 0 B. t1 Mod t2 = 0
C. t1 \ t2 = 0 D. t2 Mod t1 = 0
(43) A. If flag Then B. If t2 > t1 Then
C. If t1 > t2 Then D. If t2 >Int(Sqr( t1 )) Then
(44) A.Form1.Print "素数个数:" count
B. Print #1 "素数个数:"; count
C. Form1.Print "素数个数:" ; count
D. Form1.Print "素数个数:": count
30. 由输入对话框输入n(设 n为大于零且小于30的自然数),计算下列表达式的值,并在标签框Label1上显
示。
[程序]
14
许德武复习资料
Private Sub Form_Click()
Dim n As Integer, sum As Double, k As Integer
n = Val(InputBox("n=", "请输入自然数n(n>0且n<0)"))
Do (1)
n = Val(InputBox("n=", "qq(n>0ÇÒn<0"))
Loop
sum = 0
(2)
Do
k = k + 1
sum = (3)
Loop Until k >= n
Label1.Caption = "sum" + Str(sum)
End Sub
(1) A. While n <= 0 Or n >= 30
B. While n <= 0 And n >= 30
C. Until n > 0 Or n < 30
D. Until n >= 0 And n <= 30
(2) A. k=2 B. k=1 C. k=-1 D. k=0
(3) A. 1/(k*(k+1)) B. 1/(k-1)*k
C. sum+1/(k*(k+1)) D. sum+1/k*(k+1)
31. 本程序用于处理文本框Text1.Text中的内容,假设文本框中有偶数个字符。要求将文本框中的内容从头尾至中间依次各取字符,组成一个新的字符串Str2,并在窗体上输出。例如:Text1.Text=”12345678”,则
Str2=”18273645”
[程序]
Private Sub Form_Click()
Dim Str1 As String, Str2 As String
Str1 = Text1.Text
Str2 = ""
m = 0
Do (1)
str2=str2+ (2)
str2=str2+ (3)
m = m + 1
Loop
Form1.Print Str2
End Sub
(1) A. While m < Len(Str1) / 2 B. While m <= Len(Str1) / 2
C. Until m > Len(Str1) / 2 D. Until m < Len(Str1) / 2 (2) A. Mid(Str1, m, 1) B. Mid(Str1, Len(Str1)-m, 1)
C. Mid(m,Str1, 1) D. Mid(Str1, m+1, 1) (3) A. Mid(Str1, Len(Str1)-m+1, 1) B. Mid(Str1, m, 1)
C. Mid(Str1, Len(Str1)-m, 1) D. Mid(Str1, Len(Str1)-m, m)
32. 下面程序的功能是统计当前盘当前文件夹中的data.txt文件中共有多少个英文
单词
英语单词 下载七年级上册英语单词表下载英语单词表下载深圳小学英语单词表 下载高中英语单词 下载
(假定不超过100个,且约定连续出现的英文字母定义为一个单词),所有单词找出后存放在word数组中,并在窗体上输出。
Private Sub Form_Click()
Dim word(100) As String, St As String, ch As String*1,Temp As String
Dim Flen As long , n As Integer ,F As Boolean
___(1)___
15
许德武复习资料
Flen=Lof(10)
St=Input(Flen,#10)+space(1) ‘Input(Flen,#10)表示从文件中读出长度为Flen的数据
i=1
Do While i<=Flen+1
ch=Mid(St,i,1)
If ___(2)___Then
Temp=Temp+ ch
F=True
Elseif F=True Then
n=n+1
word(n)=Temp
Temp=___(3)___
F=False
End If
___(4)___
Loop
;"个单词" Print "共有";n
For i=1 To n
Print word(i)
Next i
End Sub
(1) A. Open "data.txt" For put As #10 B. Open "data.txt" For Input As #10
C. Open "data.txt" For Ouput As #10 D. Open "data.txt" For Append As #10
(2) A. ch>="A" And ch <="Z" B. ch >="a" And ch <="z" C. ch>="A" And ch <="Z" And ch >="a" And ch <="z"
D. ch>="A" And ch <="Z" Or ch >="a" And ch <="z"
(3) A. "" B. F C. n D. word(n) (4) A. Next i B. i=i+1 C.i=i-1 D. i=n
参考答案
一、 10, int(rnd*90)+100, I+1, 10, ntemp=a(i), a(i)=a(j), a(j)=ntemp
二、 int(rnd*41)+10, I, p=j, t=a(i), a(i)=a(p), a(p)=t 三、 int(rnd*50)+50, 1, 10-I, t=a(j):a(j)=a(j+1):a(j+1)=t 四、 a=b, b=n
五、 val(inputbox(“输入正整数n”)), I+1, n mod I=0, exit do, I>int(sqr(n)), str(n),
str(n)
六、 int(rnd*90)+10, exit for, I<=int(sqr(n)), str(n), str(n) 七、 long, S<=100000, n+1, s+n*n
八、 sum=1, sum*I, nfactor=sum
九、 1, n*nfactor(n-1)
十、 n, print mystr
十一、 len(s), mid(s,len(s)-I+1,1), invert=ns
十二、 slen=len(s), mid(temps,k,1), lstr+rstr
十三、 space(2*(4-*i));, str(2*I-1);, print
十四、 scalewidth/2, scaleheight/2, fillstyle=0, vbyellow, (x,y),r,vbred
十五、 open “a1.txt” for input as #1, not eof(1),
text1.text=text1.text+s+chr(13)+chr(10)
十六、 dir1.path=drive1.drive, file1.path=dir1.path
16
许德武复习资料
十七、 slen=len(s) mid(s,k,1) invert=newstr 十八、 n mod k=0 k>int(str(n))
十九、 file1.path=dir1.path dir1.path=drive1.drive 二十、 form1.scalewidth circle (x1/2,y2/2),r,vbred 二十一、 int(rnd*41+10) k+1 to 10 p=j
二十二、 fillstyle=0 (x,y),r/2,vbred
二十三、 slen=len(temps) mid(temps,n,1) delspc=temps 二十四、 sum=1 sum*I nfactor=sum
二十五、 open “c:\a1.txt” for input as #1 not eof(1)
text1.text=text1.text+s+chr(13)+chr(10)
二十六、 int(rnd*998)+3 a(i) swap b(i),b(j) j mod 5=0 Isprime = true
二十七、 int(rnd*90)+10 I exit for j>i
二十八、 mid(str1,i,1) p=j p<>I cmdstart.enabled=false cmdend.enabled=true
二十九、 open “e:\dataout.txt” for output as #1 t1 mod t2=0 if flag then Form1.Print
"素数个数:" ; count
三十、 ADC
三十一、 ADC
三十二、 BDA
17