Experimenting with Sets

  1. Validate a surname entry using the set constant ['A' .. 'Z', 'a' .. 'z', '-', CHR(39)].
  2. Use a set in the game of hangman to validate a guess so that a letter is rejected if it has been guessed before.
  3. Declare a type TCapsSet as above then declare as variables of this type CapsSet, VowelCapsSet and ConsonantCapsSet (to contain all the capital letters, vowels and consonants, respectively). Assign values to CapsSet and VowelCapsSet and hence write a simple assignment statement to assign all of the capital consonants to ConsonantCapsSet. Check the result by outputting all of the letters in ConsonantCapsSet. Hint for the output:
    for LoopChar := 'A' to 'Z' do ...  
  4. Write a program to invite the user to input words containing all of the vowels at least once. Use a set to examine the input words to check whether or not they contain all of the vowels.
Programming - a skill for life!

Declaration, assignment, operators and functions of sets