EG:电子政务
GIS:地理信息系统 D_Lib:数字图书馆 二级江苏VB笔试内容
1、For I = m (初值) to n (终值) step k (步长)
M、n、k发生变化时不影响循环,I 改变时影响循环的次数。 例:Option Explicit
Private sub command1_click()
Dim I as integer, m as integer, n as integer M=1: n=10
For I = m to n step a+1 M=m+1 N=n+1 I= i+1 Next I
Print m , n , I End sub
2、数组换行 窗体:
外循环 文本框:
vbCrlf 外循环 图片框:
外循环 3、累加器
Sum=sum +······ S = s $······
双重循环中,如果内循环出现累加器,在外循环中一定要清零。Sum= 0 S=” ” 例2005(秋)执行下面的程序,当单击Command1时,Picture1中显示内容的第二行与第四行分别是_________与________,Picture2中显示内容的第一行和第三行分别是________与________。
Private Sub Command1_Click()
Dim a(4, 4) As Integer, i As Integer, J As Integer Dim b(4, 4) As Integer For i=1 To 4 S=""
For J=1 To 4
a(I, j)=((i-1)*4+j)
S=S & Right("" & Str(a(I, j)), 3) next j
Picture1.Print S Next i
For i=1 To 4 For J=1 To 4 b(5-j, i)=a(I, J) Next j Next i
For i=1 To 4 S=""
For J=1 To 4
If Len(CStr(b(I, J)))<2 Then
S=S & "" & CStr(b(I, j)) & "" E1se
s=s & CStr(b(I, j)) & "" End If Next J
Picture2.Print S