题型:综合题 题类:常考题 难易度:困难
浙江省“七彩阳光”新高考研究联盟2019-2020学年高三上学期信息技术期中联考试卷
依据上述描述设计如下VB程序:
Dim xh(1 To 100) As Integer , xm(1 To 100) As String, cj(1 To 100) As Integer Dim n As Integer, m As Integer
Private Sub Form_Load()
'本过程从数据库依次读取n位同学的序号、姓名及成绩,然后按成绩降序排序,将学生序号、姓名成绩存储在数组xh、xm、cj中,结果显示在List1中,
End Sub
'显示每位同学的位置 Private Sub Command1_Click() Dim wz As String m=Val(Text1.Text) For i = 1 To n \ m For j = 1 To m If ① Then wz = wz + xm((i - 1) * m + j) + " " Else wz=xm((i-1) * m + j)+" "+wz End If Next j List2.AddItem wz wz =" " Next i If n Mod m <> 0 Then For i= To n ‘加框处改错 wz = wz + xm(i) + " " Next i List2.AddItem wz End If End Sub |
'显示每位同学的位置编号 Private Sub Command2_Click() Dim zu As Integer Dim ha As String, hb As String List3.AddItem "序号" & vbTab & "姓名" & vbTab & "位置" 'vbTab 用于字符对齐 For i = 1 To n zu = ② ha = Trim(str(zu)) If Len(ha) = 1 Then ha = "0" + ha If zu Mod 2 = 0 And zu <= n \ m Then hb = ③ Else hb = Str(i - m * (zu - 1)) End If hb = Trim(str(hb)) 'Trim 函数功能是去除字符空格 If Len(hb) = 1 Then hb = "0" + hb List3.AddItem str(i) & vbTab & xm(i) & vbTab+ ha + hb Next i End Sub |
请回答下列问题:
① ② ③
试题篮