主题:如何用数组编这道题
program p5_2;
type color=(red,orange,yellow,green,blue);
var m,m1,m2,m3:color;
s,p:integer;
begin
s:=0;
for m1:=red to blue do
for m2:=red to blue do
if (m1<>m2) then
for m3:=red to blue do
if (m3<>m1) and (m3<>m2) then
begin
s:=s+1;
write(s,':');
for p:=1 to 3 do
begin
case p of
1:m:=m1;
2:m:=m2;
3:m:=m3;
end;
case m of
red:write('red':8);
orange:write('orange':8);
yellow:write('yellow':8);
green:write('green':8);
blue:write('blue':8);
end;
end;
writeln;
readln;
end;
write('total:',s);
end.
type color=(red,orange,yellow,green,blue);
var m,m1,m2,m3:color;
s,p:integer;
begin
s:=0;
for m1:=red to blue do
for m2:=red to blue do
if (m1<>m2) then
for m3:=red to blue do
if (m3<>m1) and (m3<>m2) then
begin
s:=s+1;
write(s,':');
for p:=1 to 3 do
begin
case p of
1:m:=m1;
2:m:=m2;
3:m:=m3;
end;
case m of
red:write('red':8);
orange:write('orange':8);
yellow:write('yellow':8);
green:write('green':8);
blue:write('blue':8);
end;
end;
writeln;
readln;
end;
write('total:',s);
end.