Explore BrainMass

Chiper code in C++

You have TWO OPTIONS on how to send in this assignment (either way will get you the same credit):

[1] Either by HAND

e.g., WRITE OUT a little Table/Figure (use Excel Worksheet? MS Word "Table"? However you want to do it)
that will illustrate the 2 rows of Alphanumeric letters as follows (with OUT the "dots", of course. You'll have to fill
the alphanumeric characters:

Plaintext Letter: | abcdefghij...z ... ABCDEF ....Z 123456...0
Ciphertext Letter | gqkuiehjr... p ... VZRHPU ...T 869034...2

--- OR:

[2] Write a Program to do it. As far as a "random seed", you could get this accomplished by doing the following
(at least this is the way I would do it):
Let a random generator go from 1 to 26 for EACH SET of ALPHABET LETTERS (e.g., the CAPs and the
LOWERCASE LETTERS), and from "0" to "9" for all of the NUMBERS. and use the process of elimination to
let it GENERATE each RANDOM character.

o How would you know how to store the letters? Probably by having the original letters in an array/vector and use

(a) Have the random generator generate an "unused" letter, then STORE that letter into a global array/vector, etc.

(b) Then, use a "checking" method (that could possibly return a BOOL) to CHECK if the NEXT randomly generated
number has been used yet.

(c) If it HAS been used then let the random generator come up with ANOTHER number (until it generates an UNUSED NUMBER)

(d) If the number has NOT been used yet, then add that number to the NEXT INDEX of the array/vector us USED NUMBERS

(e) Do this in a LOOP until you have ALL of the 26 LETTERs ACCOUNTED FOR for each of the sets of ALPHA CHARACTERS,
and 1 through 10 (or 0 thru 9 if you are Zero-basing your indexes).

What Text to Decipher:
[1] If you're doing it by method [1] above (e.g., using a Word/Excel document: Decipher the words of the Declaration of Independence listed below:

IN CONGRESS, July 4, 1776.

The unanimous Declaration of the thirteen united States of America,
When in the Course of human events, it becomes necessary for one people to dissolve the political bands which have connected
them with another, and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and
of Nature's God entitle them,

[2] If you're using method [2] from above, have your program decipher the whole Declaration of Independence.

Solution Preview

Dear Student, please find attached the C++ source code. I have used C++ map class to store the map between an input character and randomly mapped cipher character. The map holds the mapping for all letters lowercase and upper case and digits. The logic is simple: check if mapping exists, if not create a random mapping checking if it is a digit or character. The program ...

Solution Summary

The Chiper code in C++ are examined.