Exercise #13 - Word Puzzle

The following is an old word puzzle: "Name a common word, besides tremendous, stupendous and horrendous, that ends in dous." If you think about this for a while it will probably come to you. However, we can solve this problem (i.e. cheat using a computer) by loading up a big text file full of words and checking each one to see if the word contains "dous" at the end.

First create a new Visual Studio project and run it.  This will create a "bin/debug" folder in your Visual Studio project folder.  Then, right-click on the following file and save it in the "bin/debug" folder:  bigwords.txt   This file contains a big list of 87314 English words.

This is the default folder that Visual Studio will check for files, so you can open it from within your program by just giving it the filename of "bigwords.txt" rather than typing in the full pathname.

Put a button on your form and in the button click:

  1. Open the file
  2. Make a loop that reads each word from the file.
  3. Close the file

Your program should output all words ending in "dous" giving you the answer to the word puzzle.

Given a string variable s, the code:   s.EndsWith("dous")    will return true if the string s ends with "dous".