ANAGRAM
Generate Anagrams
ANAGRAM is a C++ program
which takes a string of letters
and tries to produce as many anagrams as possible.
The program was written by James Cherry.
Usage:
The format of a command is
anagram letters [numbers] [suggested words]
-
letters
-
a string of lower case letters, with no spaces, to be anagrammed.
-
[numbers]
-
The optional numbers fields force the program to look for
anagrams that contain words of each length. Up to ten word lengths
may be specified. This is useful when you have a very large number
of letters (e.g., more than 20) that you wish to permute, and you
wish for the program to skip over all the anagrams containing only
short (three and four letter) words. For example, when you are
looking for anagrams of 30 letters, you might include the lengths
"8 8 8" to force three of the words to be eight letters long each.
-
[suggested words]
-
The optional suggested words fields are taken one at a time,
and they consist of lower case letters (a-z) only too; each set of
these letters is removed from the original letters, and anagrams
of the remaining letters are found. This can be useful when you
wish to find anagrams involving particular words or a proper name.
If no command line arguments are specified, you are prompted for
the arguments; after the program has found all anagrams, it returns
you to the prompt.
Usage Examples:
-
anagram jamescherry
-
Find all anagrams of "jamescherry".
-
anagram jamescherry 5
-
Forces at least one of the words to be 5 letters long.
-
anagram jamescherry 6 5
-
Forces one word to be 6 letters long and the other to be 5 long.
-
anagram jamescherry charm
-
Find all anagrams where "charm" is one of the words.
-
anagram
-
Enters interactive mode; then typing "jamescherry" at the prompt
is the same as example 1, above. Likewise "jamescherry 5" at
the prompt is the same as example 2.
Source Code:
Examples and Tests:
List of Routines:
-
ANAGRAM finds anagrams of a given set of letters.
-
CHECK_DICT ??
-
DO_SEARCH ??
-
FIND_VALID_WORDS ??
-
GET_ARGS prompts for the arguments if they weren't on the command line.
-
INITIALIZE initializes certain data.
-
PARSE_ARGS parses the command line arguments.
-
READ_DICT reads the word list from the dictionary file.
-
SEARCH ??
-
TIMESTAMP prints the current YMDHMS date as a time stamp.
You can go up one level to
the C++ source codes.
Last revised on 15 June 2007.