小林編寫了一個(gè)統(tǒng)計(jì)高三16個(gè)班級(jí)選考技術(shù)人數(shù)占比的VB程序.運(yùn)行界面如圖所示,窗體加載時(shí),從數(shù)據(jù)庫中調(diào)用數(shù)據(jù),統(tǒng)計(jì)各班選考技術(shù)的人數(shù)占比,并在列表框List1中顯示“班級(jí)”和“選技術(shù)占比”.單擊“排序”按鈕Command,數(shù)據(jù)按選技術(shù)占比降序排序,在List2中顯示排序結(jié)果.實(shí)現(xiàn)上述功能的VB程序如下,請(qǐng)回答下列問題:
(1)分析程序,可知調(diào)用的數(shù)據(jù)表的名稱為 xkqkxkqk.
(2)請(qǐng)?jiān)跈M線處填入合適的代碼.①2 to 16-i2 to 16-i、②num(cinfo(i))=num(cinfo(i))+1num(cinfo(i))=num(cinfo(i))+1、③num(i)>0num(i)>0
Dim n As Integer,i As Integer,j As Integer'變量n用于統(tǒng)計(jì)學(xué)生總數(shù)
Dim rate(l To 16)As Integer,num(1 To 16)As Integer,class (1 To 16)As Integer
Dim tech (1 To 50)As Integer,cinfo(1 To 5000)As lnteger,subj(1 To 5000)As String
Private Sub Command1_Click ( ?。?br />Dim i As Integer,As Integer,s As Integer
For i=1 To 15
For j=①2 to 15-(i-1)或者2 to 16-i①2 to 15-(i-1)或者2 to 16-i
If rate(j)>rate (j-1)Then
t=rate (j):rate(j)=rate(j-1):rate(j-1):=t
s=class(j):class(j)=class(j-1):class(j-1)=s
End If
Next j
Next i
List2:AddItem''班級(jí)''+''''+''選技術(shù)占比''
For i=1 To 16
List2.AddItem ads(class(i),3)+''''+ads(rate(i),7)+''%''
Next i
End Sub
Private Sub Form-Load( )
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
conn.ConnectionString=''Provider=Microsoft.ACE.OLEDB.12.0DATA Source=''&
App.Path&''\stuimfo.jye.ai''
conn.open
Set rs.ActiveConnection=conn
rs.open''SELECT*FROM xkqk''
此處代碼略,代碼實(shí)現(xiàn)將學(xué)生班級(jí)信息存儲(chǔ)到數(shù)組cinfo中,選考科目存儲(chǔ)到數(shù)組subj中
For i=1 To n
②num(cinfo(i))=num(cinfo(i))+1②num(cinfo(i))=num(cinfo(i))+1’將各班人數(shù)存儲(chǔ)到數(shù)組num中
Next i
For i=1 To 16
class (i)=i
If ③num(i)>0③num(i)>0Then
If subj(j)=''技術(shù)''Then
tech(i)=tech(i)+1
End If
End If
Next j
rate(i)=Round(tech(i)/num(i)*100,2)
’Round( )返回指定位數(shù)進(jìn)行四舍五入的數(shù)值
List 1.AddItem ads(class(i),3)+''''+ads(rate(i),7)+''%''
Next i
’ads( ?。┱麛?shù)轉(zhuǎn)換長(zhǎng)度固定的字符串
Function ads (x As Integer,n As Integer)As String
代碼略
End Function.
【考點(diǎn)】編輯事件處理過程的代碼.
【答案】xkqk;2 to 16-i;num(cinfo(i))=num(cinfo(i))+1;num(i)>0;①2 to 15-(i-1)或者2 to 16-i;②num(cinfo(i))=num(cinfo(i))+1;③num(i)>0
【解答】
【點(diǎn)評(píng)】
聲明:本試題解析著作權(quán)屬菁優(yōu)網(wǎng)所有,未經(jīng)書面同意,不得復(fù)制發(fā)布。
發(fā)布:2024/6/27 10:35:59組卷:6引用:1難度:0.1
相似題
-
1.學(xué)校舉辦了“語文作文現(xiàn)場(chǎng)賽”,參賽同學(xué)成績(jī)存儲(chǔ)在文本文件“gra.jye.ai”中,如左圖所示(每一行記錄一位同學(xué)的姓名和成績(jī),以“:”分隔)。陳老師利用Python程序?qū)ψ魑某煽?jī)進(jìn)行處理,統(tǒng)計(jì)出各個(gè)分?jǐn)?shù)等級(jí)的人數(shù),并輸出結(jié)果。程序運(yùn)行界面如右圖所示。
實(shí)現(xiàn)上述功能的Python程序如下,請(qǐng)?jiān)趧澗€處填入合適的代碼。發(fā)布:2024/12/17 2:0:1組卷:6引用:2難度:0.3 -
2.有如下Python程序段:
執(zhí)行該程序段,輸入字符串“abcdefg”,則輸出的結(jié)果是( ?。?/h2>發(fā)布:2024/12/20 6:30:1組卷:2引用:3難度:0.4 -
3.試題描述的內(nèi)容:
一個(gè)單窗體VB程序的運(yùn)行界面如圖所示。下列說法正確的是( ?。?br />(1)窗體內(nèi)有1個(gè)按鈕
(2)窗體內(nèi)有2個(gè)文本框
(3)窗體內(nèi)有3個(gè)標(biāo)簽
(4)該窗體的標(biāo)題(Caption)屬性值是“加法計(jì)算器”發(fā)布:2024/12/20 20:0:2組卷:1引用:1難度:0.6
把好題分享給你的好友吧~~