当前位置:首页 > 南京工业大学VB期末考试复习3
Private Sub Form_Click( )
Dim i As Integer,j As integer,n As integer N=val(txtinput) Fori=3 to n-2step 2 If ___(1)__ Then
if n-i>=i and__(2)________ then print n;\ endif End If Nexti End sub
Private Function Prime(n as integer) as boolean dim i as integer,,j as integer,,flg as boolean prime =false for i=2 to sqr(n)
if n mod i=0 then___(3)_____ nexti
Prime=true End function End If Next i End Sub
3、下面和程序功能是将一个由字母与数字相混的字符串中选出字符串,并把该字符串在窗体上打印出来,请完善下面程序。
Option Explicit
Private Sub Command1_Click( ) Dim s As String,k As Integer
Dim r As String,i As Integer,t As String s=“aa11bb22Cc33” For i=1 To Len(s) t= (1)
If t>=“a”And t<=“z”Or t>=“A”And t<=“Z”Then ____(2)___ End If Next i Print r End Sub
4、如下程序,运行的结果是____________,若将A语句改为Static i%,运行的结果是___________。Sub Proc(a%())
Dim i% 'A Do
a(i)=a(i)+a(i+1) i=i+1
Loop While i<2 End Sub
Private Sub Command1_Click() Dim m%, i%, x%(10) For i=0 To 4 x(i)=i+1 Next i
For i=1 To 2 Call Proc(x) Next i
For I=0 To 4 Print x(i); Next i End Sub
5、2Sinx+3Cosx+Tan2x+LnxLny的VB表达式为________
参考答案
1.d,2.b,3.d,4.b,5.b,6.b,7.c,8.b,9.d,10.c,11.b,12.b,13.c,14.c,15.a,16.c,17.c,18.c,19.a,20.a,21.a,22.a,23.d,24.b,25.b,26.c,27.b,28.c,29.b,30.c,31.b,32.d,33.d,34.a,35.c,36.b,37.d,38.a,39.c,40.a
1.Xx,XxYyZz,2.prime(i),prime(n-i),Exit function,3.mid(s,i,1),r=r & t,4.8 8 3 4 5,3 5 7 4 5,5.2*sin(x)+3*cos(x)+tan(2*x)+log(x)*log(y)
共分享92篇相关文档