all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -0,0 +1,26 @@
include c:\cxpl\codes; \intrinsic 'code' declarations
string 0; \use zero-terminated strings
proc SelSort(A, N); \Selection sort
char A; \address of array
int N; \number of elements in array (size)
int I, J, S, JS, T;
[for I:= 0 to N-2 do
[S:= (~0)>>1;
for J:= I to N-1 do \find smallest element
if A(J) < S then [S:= A(J); JS:= J];
T:= A(I); A(I):= A(JS); A(JS):= T;
];
];
func StrLen(Str); \Return number of characters in an ASCIIZ string
char Str;
int I;
for I:= 0 to -1>>1-1 do
if Str(I) = 0 then return I;
char Str;
[Str:= "Pack my box with five dozen liquor jugs.";
SelSort(Str, StrLen(Str));
Text(0, Str); CrLf(0);
]