26 lines
689 B
Text
26 lines
689 B
Text
include c:\cxpl\codes; \intrinsic 'code' declarations
|
|
string 0; \use zero-terminated strings
|
|
|
|
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;
|
|
|
|
func Palindrome(S); \Return 'true' if S is a palindrome
|
|
char S;
|
|
int L, I;
|
|
[L:= StrLen(S);
|
|
for I:= 0 to L/2-1 do
|
|
if S(I) # S(L-1-I) then return false;
|
|
return true;
|
|
]; \Palindrome
|
|
|
|
int Word, I;
|
|
[Word:=
|
|
["otto", "mary", "ablewasiereisawelba", "ingirumimusnocteetconsumimurigni"];
|
|
for I:= 0 to 4-1 do
|
|
[Text(0, if Palindrome(Word(I)) then "yes" else "no");
|
|
CrLf(0);
|
|
];
|
|
]
|