VB作业,请大家帮帮忙

来源:百度知道 编辑:UC知道 时间:2024/06/08 13:39:56
两个乒乓球队进行比赛,各出3人,甲队为a b c三人,乙队为X Y Z三人。已抽签决定比赛名单,有人向队员打听比赛名单。a 说他不和X比,c说他不和X Z比,请编程序找出三队赛手名单。
要用到数组和循环的嵌套

跪拜
涕零

dim w%(2),x%,y%,z%,a%,b%,c%,i%,j%,m%
x=asc("x"):y=asc("y"):z=asc("z"):a=x+y+z:b=x+y+z:c=x+y+z:w(0)=x,w(1)=y,w(2)=z
m=x
if y>m then m=y
if z>m then m=z

a=a-x
if a<=m then

print "a";
for i=0 to 2
if a=w(i) then print chr(w(i)):b=b-a:c=c-a:exit for
next i
c=c-x-z+a
if c<=m then
print "c";
for i=0 to 2
if c=w(i) then print chr(w(i)):b=b-c:print "b";:print chr(b):exit for
next i
end if
j=0
end if

if j<>0 then

a=a+x
c=c-x-z
if c<=m then

print "c";
for i=0 to 2
if c=w(i) then print chr(w(i)):b=b-c:a=a-c:exit for
next i
a=a-x
if a<=m then
print "a";
for i=0 to 2
if a=w(i) then print chr(w(i)):b=b-a:print "b";:print chr(b):exit for
next i
end if

end if