Royalty

Royalty

  • NA
  • 3
  • 14k

Checking if a sentence is a pangram or not

Apr 18 2011 4:39 AM
Hi all

I have a piece of psuedocade here and it is supposed to check if a sentence entered by a user is a pangram or not. Please have a look at it.
 

string sentence;

bool pangram ßtrue;

ARRAY: characterArray of [26] char ß {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

ARRAY: sCharacterArray of  char ß { '.', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '-', '=', '<', '|', '/', '>' };

 

       Input the sentence

       for (int i ß0;i <characterArray.Length; i++)

                IF (!sentence.ToLower().Contains(characterArray[i]))

                                pangram ß false

                ELSE

                                {

                                                for(int x = 0; x < sCharArray.Length;  x++)

                                                {

                                                       if(sentence.Contains(sCharArray[x]))

                                                                {

                                                                                pangram=false;

                                                                }

                                                        else

                                                                {

                                                                                pangram=true;

                                                                }

}

                                }

            ENDIF

ENDFOR

if ( pangram ßtrue)

                Display ('pangram');

else

                Display ('not a pangram');

ENDIF

//end program


Feedback will be appreciated. Thank you.


Answers (7)