copyright Steve J. Hodges

CS 19 Spring 2019

Assignment 3 (Codebreaker!)



Program Description

Your program will note if any command line parameters are present. In this assignment, you will read an unspecified number of lines of text from STDIN. Input is terminated with EOF (ctrl-D). When the input is completed, your program will print all of the input transformed as described below. The output will preserve the input except as described below (so for example, whitespace and punctuation will not be modified.) Your program must have no other output.

For this assignment, you may use vector or array containers. If you do any sorting, use either bubblesort or selectionsort, as described in class.

Text Transformation

Your program will find the frequency of each letter in input. Replace the 10 most frequently appearing letters with these letters (also in this order): E T A O I N S H R D. (so E replaces the most frequently appearing letter, T replaces the second most frequent letter etc.) Use as many letters as necessary if there are fewer than ten different letters in the input.

Letters that were replaced (as above) must be output in uppercase. Letters that were not replaced must be output in lowercase.

If your program recieved any command line parameters, letters that were not replaced (so letters that would normally have been output in lowercase) will be replaced with a hyphen/minus character '-' instead.

Sample Runs

Coming Soon.

What to "turn in"

As usual, leave your .cpp file for this program ("decoder.cpp") in your home directory on pengo.