Overview | Schedule | Resources | Assignments | Home |
Project 2: Random Text Generator
Write a complete C++ program which implements the random text generation algorithm discussed in class. Here is a sample run (user input in italics):
Welcome to the Random Text Generator input file? seashells.txt length of context? 2 length of output? 40 ashe seashore. sells by thells she seash
In this example, the input file seashells.txt
contains a single line:
she sells seashells by the seashore.
Brief Algorithm Description: Read the input file character by character and
create a map from each sequence of k
characters (where k
is
the given context length) to a list of each following character (preserving duplicates).
At the end of the file, append a space and wrap around to the first k
characters (this avoids the problem of what to do at the end). Now choose a random
starting sequence of length k
, then repeatedly generate a new character by
randomly choosing from the list of characters that can follow that sequence. Do this
until the desired output length has been generated (sent to cout
).
Project 3: Number Classes
You should approach this project in two phases. In each, the goal will be to integrate your new type(s) into the language as much as possible, so that they have the same "feel" as the built-in numeric types. Part of this will be a design task, so this project will be deliberately underspecified.
Final Exam
main.cpp
to print a report of names and letter gradesOverview | Schedule | Resources | Assignments | Home |
DePauw University,
Computer Science Department,
Fall 2005
Maintained by Brian Howard
(bhoward@depauw.edu
).
Last updated