Skip to content

Instantly share code, notes, and snippets.

Created March 12, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/606a121b088bd5faa638 to your computer and use it in GitHub Desktop.
Save anonymous/606a121b088bd5faa638 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <istream>
#include <string>
using namespace std;
int const NUM_ROWS = 9;
int const NUM_COLS = 8;
void encryptMessage(char encryptionMatrix[][NUM_COLS]);
void decryptMessage(char encryptionMatrix[][NUM_COLS]);
int main(void)
{
char encryptionMatrix[NUM_ROWS][NUM_COLS] = {
{ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' },
{ 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p' },
{ 'q', 'r', 's', 't', 'u', 'v', 'w','x' },
{ 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F' },
{ 'G', 'H', 'I', 'J', 'K', 'L', 'M','N' },
{ 'O', 'P', 'Q', 'R', 'S', 'T', 'U','V' },
{ 'W', 'X', 'Y', 'Z', '0', '1', '2', '3' },
{ '4', '5', '6', '7', '8', '9', ' ', '.' },
{ ',', '?', '!', ':', ';', '\'', '\"', '_' }
};
char option = 0; //stores which option is picked
bool keepGoing = true; //to keep menu running
do
{
cout << "\t MENU\n======================\n";
cout << "E: Encrypt Message \n";
cout << "D: Decrypt Message \n";
cout << "Q: Quit \n";
cin >> option;
switch (option)
{
case 'E': //calls encrptionMatrix to enter and encrypt a message
encryptMessage(encryptionMatrix);
break;
case 'D':
decryptMessage(encryptionMatrix);
break;
case 'Q':
keepGoing = false;
break;
default:
cout << "Please pick a valid option.\n\n";
break;
}
} while (keepGoing == true);
system("pause");
return 0;
}
void encryptMessage(char encryptionMatrix[][NUM_COLS])
{
string message;
cout << "Type your message: ";
cin.ignore();
getline(cin, message);
????
for (int r = 0; r < NUM_ROWS; r++)
{
for (int c = 0; c < NUM_COLS; c++)
{
???
}
}
}
void decryptMessage(char encryptionMatrix[][NUM_COLS])
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment