(順序查找/對分查找)。 Dim a(1to 500)as string‘用于存放參加考試學(xué)生的身份證號碼 Dim s(1to 500)as single‘用于存入?yún)⒓涌荚噷W(xué)生的總分成績 ‘form_load 過程用于進(jìn)行一些初如化準(zhǔn)備工作 Private Sub form_load ( ) ‘將參加此次考試學(xué)生的身份證號碼存放在數(shù)組a中 ‘將參加此次考試學(xué)生的總分成績存放在數(shù)組s中 For i=1to 499‘利用排序法將學(xué)生成績進(jìn)行降序排序 For j=500to i+1step-1 If ① then t=s(j):s(j)=s(j-1):s(j-1)=t t=a(j):a(j)=a(j-1):a(j-1)=t End If Next j ② End sub ‘command1_click過程用于查詢學(xué)生的總分成績及排名 Private sub command_click ( ) Dim,bank as integer‘bank為排名 Dim index as Boolean‘index為查詢憑證 Dim hm as string’hm為身份證號碼 hm=text1.text index=false For i=1to 500 If hm=a(i) then index=true:bank=i:exit for‘代碼exit for的作用為退出for循環(huán) Next i If index=true then Text2.text=str(s(bank)) Text3.text=str(bank) Else Msgbox (“無此身份號碼”) End if。