用VB编写一个比赛分组抽签程序,把八支队伍随机分成A,B两个小组,每个小组各有四支,急求啊

2025-06-26 05:28:46
推荐回答(1个)
回答1:

dim team(7) as string,i%,iA%,iB%
randomize
for i=0 to 7
if int(rnd*2)=0 and iA<4 then
team(i)="A"
iA=iA+1
elseif iB<4 then
team(i)="B"
iB=iB+1
else
team(i)="A"
end if
next
for i=0 to 7
if team(i)="A" then
print "第" & i+1 & "支队伍为A小组"
else
print "第" & i+1 & "支队伍为B小组"
endif
next