题型:综合题 题类:模拟题 难易度:困难
浙江省名校信息技术仿真训练卷(二)
实现上述功能的VB程序如下,请回答下列问题:
Dim num As Integer ‘变量num存储数据库实际的记录数
Dim book(1 to 5 000)As String
Dim content(1 To 5 000)As String,content1(1 To 5 000)As String ‘存储类别内容
Dim sales(1 To 5 000)As Long,sales1(1 To 5 000)As Long ‘存储销售量
Private Sub Form Load( )
Dim conn As New ADODB.Connection,rs As New ADODB.Recordset
Dim strSQL As String
conn. ConnectionString="Provider=Microsoft. ACE. OLEDB. 12. 0; Data Source="&App. Path&"\major. accdb"
conn. Open
strSQL="SEl.ECT*FROM count"
Set rs.ActiveConnection=conn
‘从数据表中读取图书类别、类别内容、销售量分别存储到数组book、content、sales中
‘数据库实际读取的记录数存储在变量num中
‘代码略
End Sub
Private Sub Command1_Click()
Dim m As String,n As String,c As Integer,s As Long
Dim i As Integer,j As Integer,k As Integer
List1.Clear
c=0:s=0
m=Text1.Text
For i=l To num ‘将符合的类别内容、销售量重新存储到数组content1、sales1中
If m=book(i)Then
c=c+1
content1(c)=content(i)
sales1(c)=sales(i)
‘①
EndIf
Next i
For i=1 To ‘②
List1.AddItem content1(i)&" "&Str(sales1(i))
Next i
Text2.Text=Str(s)
End Sub
①②
a(1) | a(2) | a(3) | a(4) | a(5) | a(6) |
69 | 58 | 32 | 21 | 39 | 33 |
若采用冒泡排序算法对这组数据进行升序排列,那么在完成第一遍排序时,数组元素a(1)到a(6)的数据依次是( )
试题篮