Introduction to: Strings and Dates At some point virtually all computer programs have to come in contact with human beings with whom they have to communicate to interact. And a primary vehicle for this is textual information. We know that computers use combinations of binary digits to represent letters, numbers, and other symbols [e.g., punctuation]. The coding system most commonly found today is called ASCII [American Standard Code for Information Interchange]. It turns out that when it has to deal with strings of characters C++ treats them as an array [an array with the base type of char.] Dates are a specialized representation of data, and are treated in a couple of ways. |
I came across a puzzle in a magazine that required you to decode a message composed of Wingdings icons. So, using what you’ve learned so far about C++ and the image below, write a C++ program that takes a text string [this text can include only alphabetic and characters] as input from a user, and using the relationships between letters and numbers present on a rotary telephone dial, encode the message. For example, the text string ‘hello’ would become ‘43556’. You then output back to the user the encoded message. Note that what you encode cannot be directly decoded, as there is not a one-to-one correspondence. What the puzzle makes you do is look at the frequency of certain symbols and go through various permutations that form words that might be valid translations. |
|
|
|
|
|
|
|
|
|
|
I have to use the values on the phone in the image I posted, not ASCII. It's a rotary phone and it's not the same as a regular cell phone keyboard, but it's close. So for an example L would be 555 and J would be 5. |
|
|
|
|