Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Pangram-checker/XPL0/pangram-checker.xpl0
Normal file
31
Task/Pangram-checker/XPL0/pangram-checker.xpl0
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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 Pangram(S);
|
||||
char S;
|
||||
int A, I, C;
|
||||
[A:= 0;
|
||||
for I:= 0 to StrLen(S)-1 do
|
||||
[C:= S(I);
|
||||
if C>=^A & C<=^Z then C:= C or $20;
|
||||
if C>=^a & C<=^z then [C:= C - ^a; A:= A or 1<<C];
|
||||
];
|
||||
return A = $3FFFFFF;
|
||||
]; \Pangram
|
||||
|
||||
int Sentence, I;
|
||||
[Sentence:=
|
||||
["The quick brown fox jumps over the lazy dog.",
|
||||
"Pack my box with five dozen liquor jugs.",
|
||||
"Now is the time for all good men to come to the aid of their country."];
|
||||
for I:= 0 to 3-1 do
|
||||
[Text(0, if Pangram(Sentence(I)) then "yes" else "no");
|
||||
CrLf(0);
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue