学号 |
姓名 |
性别 |
出生年份 |
户籍所在地 |
注册日期 |
是否住校 |
201802001 |
张立 |
男 |
2003 |
杭州市江干区 |
2018/8/31 |
是 |
201901001 |
李红 |
女 |
2004 |
杭州市西湖区 |
2019/9/1 |
否 |
… |
… |
… |
… |
… |
… |
… |
下列关于该学生管理信息系统的描述,错误的是 ( )
a(1) = 1: a(2) = 1
b(1) = 1: b(2) = 2
For i = 3 To 5
a(i) = a(i - 1) + a(i - 2)
b(i) = b(i - 1) + a(i)
Next i
执行该程序段后,数组元素b(5)的值为( )
key=Val(Text1.Text)
s=“ ”
i = 1 : j = 10
Do While i <= j
m =(i+j)\2
s = s+ Str(a(m))
If a(m)> key Then j = m -1 Else i = m +1
Loop
Text2.Text = s
数组元素a(1)到a(10)的值依次为“2,3,5,8,9,10,13,17,19,20”。在文本框Text1中输入待查找的数,执行该程序段,则文本框text2中显示的内容可能的是 ( )
图 b
Private Function bw(x As Integer, y As String) As String
'函数bw功能:若二进制位数不足,通过在前面添"0"使得位数为4的倍数
Dim r As Integer, i As Integer
r = x Mod 4
If r <> 0 Then
For i = 1 To 4 - r
y = "0" + y
Next i
x = Len(y)
End If
bw=
End Function
Private Sub Command1_Click()
Dim m As String, n As Integer, i As Integer, a As Integer
Dim s As Integer, s1 As String, j As Integer
m = Text1.Text
n = Len(m)
Text2.Text = ""
m = ’调整 m 的位数为 4 的倍数
For i = 1 To n - 3 Step 4
s = 0
For j = i To i + 3
a = Val(Mid(m, j, 1))
s =
Next j
If s >= 10 Then
s1 = Chr(Asc("A") + s - 10)
Else
s1 = CStr(s) '函数 CStr 类似于 Str,但无前导空格
End If
Text2.Text = Text2.Text + s1
Next i
End Sub
请回答下列问题:
Const n = 6
Dim a(1 To n * n) As Integer
Private Sub Form_Load() '产生 n * n 个数组元素,每行按 n 个数显示在 list1 中
For i = 1 To n * n
a(i) = Int(Rnd * 90) + 10
s = s + Str(a(i))
If ① Then
List1.AddItem s
s = ""
End If
Next i
End Sub
Private Sub Command1_Click()
Dim i As Integer, j As Integer, w As Integer, s As String
For i = 1 To n * n
k = i
For j = k + n To ②
If a(k) > a(j) Then k = j
Next j
If Then t = a(k): a(k) = a(i): a(i) = t
Next i
'将排序后数组 a 的元素,按每行 n 个数显示在 list2 中,代码略
End Sub
① ②