实现上述功能的VB程序如下,请回答下列问题:
Dim xn(1 To 50) As String, sg(1 To 50) As Integer
Dim n as integer, i as integer, j as integer, ch as string, t1 8s string, t2 as integer
Private sub form_load( ) ‘把数据表中姓名和身高分别存储到数组xm( )和sg( ),代码略
‘按身高从低到高对学生数据进行排序,代码略
List1.Clear
List1.AddItem“第一组”+“第二组”+“第三组”+“第四组”
List1.AddItem
“------------------------------------------------------------”
‘将排序好的学生姓名按6行8列的格式输出在列表框list1中
For i=1 To n
ch=ch+xm(i)+””
If i Mod2=0 Then ch=ch+””
If Then
List1.Addltem ch
ch=””
End If
Next i
End Sub
Private Sub Com1_Click( )
Dim a(1 To 50) As String, b(1 To 50) As String
Dim st As String
‘下面进行组与组之间的调换,调换后的数据保存在数组a中
For i =1 To 6
For j=1 To 8
a((-1)*8+j)=
Next j
Next i
‘下面进行同桌之间互换位置,互换后的数据保存在数组b中
For i=1 To 6
For j=1 To 8
If j Mod2=1 Then
b((-1)*8+j)=
Else
b((i-1)*8+j)=a((-1)*8+j-1)
End If
Next j
Next i
‘在列表框List2中输出轮换后的结果,代码略
‘下面进行数据重新赋值,为下一次轮换做准备
For i=1 To 48
xm(i)单b(i)
Next i
End Sub