2014-06-24 回答
不知道楼主能不能等,我正在补充做界面设计。。。
总算完了,虽然还不是很理想,但能达到楼主的要求了,若还不满意,可联系再调整。。。
放置三个控件:一个text1,一个command1,一个label1,把它们的index属性都设置为0。窗体的大小、控件的大小、位置和其它属性由程序自动设定。代码如下:
dimiasinteger,masinteger,jasinteger,kasinteger,pasinteger
dimstasstring,msgasstring
dimx(4,2)asstring,b(12,2)asstring,jx(4)asstring
dimf()assingle,lassingle,minasinteger,maxasinteger
privatesubcommand1_click(indexasinteger)
selectcaseindex
case0
do
msg=""
st=inputbox("评委人数(>5人)","输入",10)
ifst=""then
msg="错误,请输入评委人数(>5人)!"
else
ifnotisnumeric(st)then
msg="错误,请输入数字(>5)!"
else
p=int(val(st))
ifp<5then
msg="错误,评委人数不得少于5人!"
else
exitdo
endif
endif
endif
ifmsg<>""thenmsgboxmsg
loop
command1(0).visible=false
command1(1).visible=true
form1.cls
callxu
redimf(12,p)
randomize
j=1
k=1
label1(0).caption=b(j,2)+"得分"
label1(1).caption="第"+str(k)+"位评委打分"
fori=0to3
text1(i).text=str(int(rnd*2*100)/100)
next
case1
msg=""
fori=0to3
iftext1(i).text=""then
msg="请填写的得分!"
exitfor
endif
ifval(text1(i).text)<0orval(text1(i).text)>val(x(i+1,2))then
msg="的得分应在0——"+x(i+1,2)+"之间!"
exitfor
endif
next
ifmsg<>""then
msgboxmsg
text1(i).text=""
text1(i).setfocus
exitsub
endif
l=0
fori=0to4
l=l+val(text1(i).text)
next
f(j,k)=l
k=k+1
ifk>pthen
min=1
max=1
fori=2top
iff(j,min)>f(j,i)thenmin=i
iff(j,max)
next
l=0
fori=1top
l=l+f(j,i)
next
l=l-f(j,min)-f(j,max)
l=l/(p-2)
b(j,1)=str(l)
k=1
j=j+1
ifj>12then
command1(1).visible=false
fori=1to11
forj=i+1to12
ifval(b(i,1))
st=b(i,1)
b(i,1)=b(j,1)
b(j,1)=st
st=b(i,2)
b(i,2)=b(j,2)
b(j,2)=st
endif
next
next
callyc
print"名次","班级","得分","奖项"
fori=1to4
printi,b(i,2),b(i,1),jx(i)
next
fori=5to12
printi,b(i,2),b(i,1)
next
exitsub
endif
endif
fori=0to3
text1(i).text=""
next
label1(0).caption=b(j,2)+"得分"
label1(1).caption="第"+str(k)+"位评委打分"
fori=0to3
text1(i).text=str(int(rnd*2*100)/100)
next
case2
end
endselect
endsub
privatesubform_load()
form1.autoredraw=true
form1.caption="打分系统"
form1.width=7000
form1.height=5000
x(1,1)="感情表达恰当"
x(2,1)="表现力强"
x(3,1)="口齿清晰"
x(4,1)="仪态自然"
x(1,2)="3分"
x(2,2)="3分"
x(3,2)="2分"
x(4,2)="2分"
fori=1to6
loadlabel1(i)
label1(i).visible=true
next
fori=0to1
label1(i).width=1500
label1(i).height=400
label1(i).left=1000+i*1500
label1(i).top=400
label1(i).caption=""
next
fori=2to6
label1(i).width=1700
label1(i).height=400
label1(i).left=4000
label1(i).top=430+(i-2)*600
label1(i).alignment=2
ifi<>6then
label1(i).caption=x(i-1,1)&vbcrlf&"("&x(i-1,2)&")"
endif
next
label1(6).caption="总分"
fori=1to4
loadtext1(i)
text1(i).visible=true
next
fori=0to4
text1(i).width=1200
text1(i).height=400
text1(i).left=5400
text1(i).top=400+i*600
text1(i).text=""
next
fori=1to2
loadcommand1(i)
command1(i).visible=true
next
fori=0to2
command1(i).width=1200
command1(i).height=400
command1(i).left=4000+(i\2)*1300
command1(i).top=3800
next
command1(0).caption="开始"
command1(1).caption="确定"
command1(1).visible=false
command1(2).caption="退出"
fori=1to12
b(i,2)=str(i)+"班"
next
jx(1)="最佳气质奖"
jx(2)="最佳表现奖"
jx(3)="最佳风采奖"
jx(4)="最具潜力奖"
callyc
print"古诗词朗诵比赛活动方案,12个班级,感情表达恰当(3分)表现力强(3分)口齿清"
print"晰(2分)仪态自然(2分)。去掉一个最高分、去掉一个最低分,所得总分除以评委人"
print"数,即为选手最后得分。奖项:比赛设最佳气质奖、最佳表现奖、最佳风采奖、最具"
print"潜力奖。(即1,2,3,4等奖)评委人数当场输入,最后显示获得奖项的班级号。"
print"http://zhidao.baidu.com/question/98262660.html"
print"特别说明:本程序用doloop和ifelse语句完成"
print"单击【开始】按钮......"
endsub
privatesubyc()
fori=0to6
label1(i).visible=false
next
fori=0to4
text1(i).visible=false
next
endsub
privatesubxu()
fori=0to6
label1(i).visible=true
next
fori=0to4
text1(i).visible=true
next
endsub
privatesubtext1_change(indexasinteger)
dimiiasinteger
dimj1assingle,j2assingle
iftext1(0).text=""then
j2=0
else
j2=val(text1(0).text)
endif
forii=1to3
iftext1(ii).text<>""then
j1=val(text1(ii).text)
j2=j2+j1
endif
next
text1(4).text=j2
endsub
privatesubtext1_gotfocus(indexasinteger)
ifindex=4thentext1(0).setfocus
endsub
已经运行过。
已经发送。