
With
the use of the fact that A CHARACTER HAS AN ASCII VALUE FOR EACH LETTER (a=65,
b=66…), create a word-coding program.
You enter a sentence and C++ encrypts is (puts it into code). Your program will start by calling a menu
that looks like this…
********************************************
MENU
1)
PUT
MESSAGE INTO CODE
2)
DECODE
A MESSAGE
3)
QUIT
********************************************
-1
Please
enter your sentence…
The
little kitty was eaten by the mean dog.
Decoded
message:
Vjd”nkvvg”mkvv{“ycugp”d{“vjg”ogcp”fqi0
You
will enter the word into a character array…char nam[100]
To
print it back in code you will have a code KEY. The one above just added TWO to the current ASCII. You must decide your own code. If the person enters the coded message, just
do the opposite of the coded. (for above –2)
Hint: for (x=0; x<strlen(nam); ++x)
cout<<(nam[x]+2); //or char(name[x]-2) for de-coding