Games: Advanced 3
This one involves reading a text file, finding all the words that use a single vowel (may have multiple instances of that vowel e.g. look) and write them out to a text file.
Delete the answer file if it exists. Read the file & loop through the contents. Quick & dirty brute force approach for this one. Convert the work to a character array and use contains to check for vowel membership – only 5 vowels so 5 if statements. Tried a switch but it counts each each instance so wrecks the result ie didn’t accept “look”. For each hit increment the counter ($y).
At the end if $y = 1 it means we have only one vowel in the word so write it to the text file.
Not a task I need to do very often but it works.