Purchase Solution

C++ secret message decoder program

Not what you're looking for?

Ask Custom Question

For each the following programs, ensure you use the file names identified, comment in an appropriate manner, format your code appropriately (vertical and horizontal whitespace... aka. blank lines and tabs), and use good/appropriate variable names. You should expect the user to always type appropriate input (e.g., not words when a number is requested).

Decoding a secret message

Write a program that decodes a message that was encoded using a random key. These keys work similar to a magic decoder wheel (where 'A' encodes to 'F', 'B' encodes to 'G', 'C' encodes to 'H', etc)except there is a random mapping from one letter to another...


plain message encodded message

You job is to read in a file named "encoded.txt" that contains 3 lines:
1. the random key (all uppercase)

2. the number of characters in the message (this will never be as high as 100, so an array of 100 characters will be a perfect variable to read the message into, one character at a time)

3. the encoded message (mixed case AND with punctuation and whitespace)
Your program should print the decoded message to the screen, but it should retain the upper or lower case-ness of each letter of the encoded message and print anything that isn't a letter as-is... that way the whitespace and punctuation are retained.

Here's an example encoded.txt for you to test with...
Icu'y hp bccdpi ha ynp lctvk ynjy F wcy... F'g roky, F'g roky Jgck blcg ynp hdctv.

Purchase this Solution

Solution Summary

This solution helps with a C++ secrete message decoder program.

Solution Preview

Please see the attachment.

// DecodeDemo.cpp

#include <fstream>
#include <iostream>
#include <string>

using namespace std;

int search(char c, char *key) {
for (int i=0; i<26; i++) {
if (c==key[i]) return i;
return ...

Purchase this Solution

Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

C# variables and classes

This quiz contains questions about C# classes and variables.