Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
include xpllib; \for Print
|
||||
|
||||
int Items, Size, I, J, Gap, JG, T, C, Count;
|
||||
[Items:= ["violet", "red", "green", "indigo", "blue", "yellow", "orange"];
|
||||
Size:= 7;
|
||||
Count:= 0;
|
||||
Gap:= Size>>1;
|
||||
while Gap > 0 do
|
||||
[for I:= Gap to Size-1 do
|
||||
[J:= I - Gap;
|
||||
loop [JG:= J + Gap;
|
||||
Count:= Count+1;
|
||||
Print("%2d: Is %6s less than %6s (y/n)? ",
|
||||
Count, Items(J), Items(JG));
|
||||
repeat OpenI(1);
|
||||
C:= ChIn(1);
|
||||
until C=^y or C=^n;
|
||||
ChOut(0, C); CrLf(0);
|
||||
if C = ^y then quit;
|
||||
T:= Items(J); Items(J):= Items(JG); Items(JG):= T;
|
||||
J:= J - Gap;
|
||||
if J < 0 then quit;
|
||||
];
|
||||
];
|
||||
Gap:= Gap>>1;
|
||||
];
|
||||
Print("The colors of the rainbow, in sorted order, are:\n");
|
||||
for I:= 0 to Size-2 do Print("%s, ", Items(I));
|
||||
Print("%s\n", Items(I));
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue