How to resolve the algorithm Pangram checker step by step in the Action! programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Pangram checker step by step in the Action! 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 Action! programming language

Source code in the action! programming language

INCLUDE "D2:CHARTEST.ACT" ;from the Action! Tool Kit

DEFINE CHAR_COUNT="26"

BYTE FUNC IsPangram(CHAR ARRAY t)
  BYTE ARRAY tab(CHAR_COUNT)
  BYTE i,c

  FOR i=0 TO CHAR_COUNT-1
  DO tab(i)=0 OD

  FOR i=1 TO t(0)
  DO
    c=ToLower(t(i))
    IF c>='a AND c<='z THEN
      tab(c-'a)=1
    FI
  OD

  FOR i=0 TO CHAR_COUNT-1
  DO
    IF tab(i)=0 THEN
      RETURN (0)
    FI
  OD
RETURN (1)

PROC Test(CHAR ARRAY t)
  BYTE res

  res=IsPangram(t)
  PrintF("""%S"" is ",t)
  IF res=0 THEN
    Print("not ")
  FI
  PrintE("a pangram.")
  PutE()
RETURN

PROC Main()
  Put(125) PutE() ;clear screen
  Test("The quick brown fox jumps over the lazy dog.")
  Test("QwErTyUiOpAsDfGhJkLzXcVbNm")
  Test("Not a pangram")
  Test("")
RETURN

  

You may also check:How to resolve the algorithm Bitmap/Midpoint circle algorithm step by step in the Forth programming language
You may also check:How to resolve the algorithm Fibonacci word step by step in the CLU programming language
You may also check:How to resolve the algorithm Department numbers step by step in the Gambas programming language
You may also check:How to resolve the algorithm Binary digits step by step in the Oberon-2 programming language
You may also check:How to resolve the algorithm String length step by step in the Octave programming language