题型:综合题 题类:常考题 难易度:困难
浙江省台州市书生中学2017-2018学年高二下学期信息技术起始考试卷
图1 | 图2 |
Private Sub Command1_Click()
Const code = "0123456789ABCDEF"
Dim s1 As String, s As String '变量s存储转换后的结果
Dim x As Long, R As Integer
If R >= 2 And R <= 16 Then
x = Val(Text1.Text)
s = ""
Do While x > 0
y = x Mod R
x =
s1 = Mid(code, y + 1, 1) '将余数转换为对应的字符
s =
Loop
List1.AddItem "(" & Text1.Text & ")10" & " →(" & s & ")" & R
End If
End Sub
依据上述描述设计如下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 |
请回答下列问题:
试题篮