题型:单选题 题类:常考题 难易度:普通
浙江省台州市2017-2018学年高三上学期信息技术期末质量评估卷
Dim a(1 T0 5)As Integer
Dim c As Integer
a(1)=44:a(2)=36:a(3)=58:a(4)=65:a(5)=12
b=0:c=0
For i=1 To 4
k=i
For j=i+1 To 5
If a(j)<a(k) Then
k=j
b=b+1
End If
Next j
If k<>I Then
t=a(i):a(i)=a(k):a(k)=t
c=c+1
End If
Next i
Text1.Text=Str(b)+Str(c)
运行该程序段后,文本框Text1的内容是 ( )
Dim class(1 To 30) As Integer '存放班级序号的数组定义为class
Dim score(1 To 8) As single '存放班级各评委打分的数组定义为score
Private Sub Formload() '提取某班级的评委打分
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + App.Path + "\bbygs.accdb "
conn.Open
Set rs.ActiveConnection = conn
rs.Open "SELECT * FROM score "
n = 0
Do While Not rs.EOF '到最后一条记录后退出循环
n = n + 1
class (n) = rs.Fields("班级序号").Value
score (n) = rs.Fields("评委打分").Value
rs.MoveFirst '①指针移动到下一条记录
Loop
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
for i=1 to n
List1.AddItem str(score(i))
Next i
End sub
Private Sub Command1Click()
Dim i as integer
Dim j as integer
Dim t as single
For i = 1 to 8 For j=1 to i If ② then t=score(j) score(j)=score(j+1) score(j+1)=t End if Next j Next i |
For i=1 to 8
List2.AddItem str(score(i))
Next i
End sub
Private Sub Command2Click() '计算班级平均得分
Dim i As Integer
Dim sum As single
For i=2 to 7
sum=sum+score(i)
Next i
Text1.text= ③
End sub
试题篮