Note: The due date has been changed. See above.
Note: This is modified version of one of the six programming problems given during the (five-hour long) ACM Mid-Central Regional programming contest last November.
Note: I have a few comments on the class bulletin board page concerning file I/O that you may find helpful.
In newspapers across the United States there is a word game called
Jumble. The object of this game is to solve a riddle, but in
order to find the letters that appear in the answer it is necessary to
unscramble four words. Your task is to write a program named
Unscramble
that can unscramble words.
This program has two input files. Both files are text files that contain lists of "words". For our purpose here assume that a "word" is any nonempty sequence of lowercase, alphabetic Ascii characters ('a' thru 'z') without any embedded space characters or punctuation. Each word is written by itself on a line of the file. Assume there are no errors in the input file.
For each scrambled word in the input, output to a third file an alphabetical list of all vocabulary words that can be formed by rearranging the letters in the scrambled word. Each word in this list must appear on a line by itself. If the list is empty (because no vocabulary words can be formed), output the left-justified line
where "xxx" is preceded by two blanks and replaced by the scrambled word. In either case, show that the processing of a scrambled word is finished by outputing a line with exactly ten asterisks on a line by themselves.INVALID WORD: xxx
**********
The file names should be taken as command line arguments of the program. They must be given in the order described above, vocabulary list, scrambled word list, and output file.
Example vocabulary list:
tarp given score refund only trap work earn course pepper part
Example scrambled word list:
resco nfudre aptr sett oresuc
Example output file:
score ********** refund ********** part tarp trap ********** INVALID WORD: sett ********** course **********
Other instructions:
UP to CSCI 433 assignments document?