RosettaCodeData/Task/Dutch-national-flag-problem/Run-BASIC/dutch-national-flag-problem.basic
2023-07-01 13:44:08 -04:00

18 lines
315 B
Text

flag$ = "Red,White,Blue"
print "Random: |";
for i = 1 to 10
color = rnd(0) * 3 + 1
balls$(i) = word$(flag$,color,",")
print balls$(i);" |";
next i
print :print "Sorted: |";
for i = 1 to 3
color$ = word$(flag$,i,",")
for j = 1 to 10
if balls$(j) = color$ then
print balls$(j);" |";
end if
next j
next i