How to resolve the algorithm Pangram checker step by step in the XPL0 programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Pangram checker step by step in the XPL0 programming language
Table of Contents
Problem Statement
A pangram is a sentence that contains all the letters of the English alphabet at least once. For example: The quick brown fox jumps over the lazy dog.
Write a function or method to check a sentence to see if it is a pangram (or not) and show its use.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Pangram checker step by step in the XPL0 programming language
Source code in the xpl0 programming language
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<
];
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);
];
]
You may also check:How to resolve the algorithm String append step by step in the PowerShell programming language
You may also check:How to resolve the algorithm Terminal control/Preserve screen step by step in the Applesoft BASIC programming language
You may also check:How to resolve the algorithm Semordnilap step by step in the Ada programming language
You may also check:How to resolve the algorithm Keyboard input/Keypress check step by step in the Logo programming language
You may also check:How to resolve the algorithm Move-to-front algorithm step by step in the MATLAB programming language