%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % hang4.t % Name : joe student % Tutor: joe Lim % Prof: Michelle Craig % Student Number : 000000000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% const VOWELS : string := "AEIOUaeiou" const CONSONANTS : string := "BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz" var original : string var toPrint : string := "" var guessedLetters : string := "" put "player 1 please enter a word" get original %put original % added for running with a test file %original := "yesterday" for testing purposes %cls %put "the word was ", original put " _ stands for a consonant" put " = stands for a vowel " put skip for guesses : 1 .. 10 for i : 1 .. length (original) % step through the word one char at a time % each time original(i) is the character we are considering if index (guessedLetters, original (i)) not= 0 then % already guessed toPrint := toPrint + original (i) + " " elsif index (CONSONANTS, original (i)) not= 0 then % found a consonant % put original(i), " is a cons" % then print underscore toPrint := toPrint + "_ " elsif index (VOWELS, original (i)) not= 0 then % found a vowel % print an equal sign % put original(i), " is a vowel" toPrint := toPrint + "= " else % this one is a special char % just print the character % put original(i), "is a special char" toPrint := toPrint + original (i) + " " end if % put "toPrint is now ",toPrint end for % put "we are done the loop" put " the word to guess is ", toPrint var guess : string put "please enter your guess " .. get guess guessedLetters := guessedLetters + guess % add to the guessed set toPrint := "" % reset to start building again end for put skip, "thanks for playing"