请帮我看看这段VB程序哪里有错,运行后command1无任何反应,点command2只在picture1中显示名次

[复制链接]
查看11 | 回复1 | 2011-2-24 12:13:59 | 显示全部楼层 |阅读模式
6个评委为4位歌手打分,分数介于1-100之间。去掉一个最高分,一个最低分,求出每位选手的最后得分。将4位歌手得分从高到低排列输出,同时输出该选手的编号。
如:歌手395分
歌手 187分
歌手 480分
歌手 270分
Option Explicit: Option Base 1
Private Type candidates

number As Integer

score As Single
End Type
Dim a(4) As candidates

Private Sub Command1_Click()
Dim max As Integer, min As Integer, i As Integer, j As Integer, t As Single
For i = 1 To 4

a(i).number = i

max = 60: min = 99

For j = 1 To 6

t = Int(Rnd * 40 60)

If tmax Then max = t

If tmin Then min = t

a(i).score = a(i).score t

Next

a(i).score = (a(i).score - max - min) / 4
Next
End Sub

Private Sub Command2_Click()
Dim t As candidates, i As Integer, j As Integer
For i = 1 To 4

For j = 1 To 4 - i

If a(j).scorea(j 1).score Then

t = a(j): a(j) = a(j 1): a(j 1) = t

End If

Next
Next
For i = 1 To 4

Picture1.Print a(i).number, a(i).score
Next
End Sub

Private Sub Form_Load()
Picture1.FontSize = 16
End Sub
回复

使用道具 举报

千问 | 2011-2-24 12:13:59 | 显示全部楼层
<pre id=\\\"best-answer-content\\\" class=\\\"reply-text mb10\\\">Picture1.Print a(i).number, a(i).score
改成:
Picture1.Print a(i).number defds123 \\\"-\\\" defds123 a(i).score
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行