|NOTE: this is a proposed schedule, check back for updates!|
Programming Assignment 1: Hamming DistancesAssigned: 1/12
Due: 1/29 by email before the start of class
Libraries you may use:
What you need for Wednesday part 1 checkin (1/17):
The Hamming Distance between two strings is the number of positions in the strings where the corresponding character is different. In this first assignment you will be prompting the user for two strings, computing the Hamming Distance between them, and then reporting the result to the user.
Traditionally, Hamming Distances are only computed between strings of the same length. Our program is going to be a bit more flexible, and count differences in string length towards Hamming Distance. For example: The difference between "per" and "person" will be 3.
For your first assignment, I have provided a general program structure, including stubs for each function you will need. If you wish, you may write additional helper functions to solve the problem, though you are not required to do so.You can download the program outline here: distance.cpp. NOTE: does not always open correctly in Microsoft Edge/IE, instead use Chrome.
A sample run of your program should match the following: Please enter string 1: per
Please enter string 2: person
per and person are 3 characters apart
A second sample run:
Please enter string 1: apple
Please enter string 2: pineapple
apple and pineapple are 9 characters apart
NOTE: for this last example we are not matching the first string to the "apple" part of "pineapple", and instead just looking from the beginning of both strings. This is a more difficult problem and beyond the scope of this class.
What to turn in: