题库 高中信息

题干

(加试题)试场编排方法:每试场人数30,尾数试场可能不足30,按6行5列的布局编排试场,每个试场的座位号如下图所示。编写一个VB程序实现上述功能:在文本框Textl中输入学生数n,在文本框Text2中输入试场号m,单击“确定”按钮Commandl,在列表框中Listl中输出第m试场的编排表,程序运行界面如图b所示。
(1)999个学生的考号依次是001,002,...,998,999。根据上述试场编排方法,可知第3试场第2行第3列的学生考号是_______________。
(2)小王根据上述算法,设计了一个加密程序,其VB代码如下,请在划线处填入合适的代码。
Const k=30
Function adj(s As String)As String
‘功能:在字符串s前添加若干个空格,代码略。
End Function
Function convert(n As Integer) As String
‘功能:把n转字符串,不足3位则在前面补0,代码略。
End Function
Private Sub Commandl_Click()
Dim kh(1 To 999)As String
Dim n As Integer,m As Integer,kcs As Integer
Dim i As Integer,j As Integer,line As String
Dim start As Integer,ofsetl As Integer,offset2 As Integer
n=Val(Text1.Text)
m.Val(Text2.Text)
For i=1 To n.

kh(i)=convert(i)

Next i
If n Mod k=0 Then kcs=n\k Else___________
If m>kcs or m<l Then

Label3.Caption="无该试场!"

Else

___________

For i=l To 6

line=""
offsetl=i
line=line+adj(kh(start+ofst))
For j=2 To 5
If j Mod 2=1 Then
Offset l=offset1+12
line=line+adj(kh(start+ffset!))
Else
___________
line=line+adj(kh(start+offset2))
End If
Next j
List1.AddItem line

Next i

End If
End Sub
上一题 下一题 0.99难度 填空题 更新时间:2019-11-19 07:47:23

答案(点此获取答案解析)