I have this assignment . I did too many methods but still needs more to make the program runs as must.
The user should be able to work with an ongoing, "current" message by repeatedly choosing following
actions:
m enter a new current message from the keyboard
c encrypt the current message using the Caesar Cipher
C decrypt the current message using the Caesar Cipher
v encrypt the current message using the Vigenere Cipher
V decrypt the current message using the Vigenere Cipher
h help the user by displaying these choices
q quit the program
#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
constint MLS = 50;
typedefchar element;
class AList{
private:
element items[];
int size;
char ReadElement();
public:
char CommandMenu();
char SubMenu();
string GetPlainTxt();
string GetKey();
string CeaserEncryption();
string CeaserDecryption();
string VigenereEncryption();
string VigenereDecryption();
};
class LList{
public:
private:
};
int main(){
AList A;
A.CommandMenu();
}
char AList::CommandMenu(){
char uservalue;
cout << "Cipher Program, Version 1.0 (c) 2011, (Chris Feck)"
<< endl;
cout << "Current message is " << items << endl;
cout << "Command (h for Help): " << endl;
uservalue = ReadElement();
if(uservalue == h)
A.Submenu();
elseif(uservalue == m)
cout << "Hmm...";
elseif (uservalue == c)
A.CeaserEncryption();
elseif (uservalue == C)
A.CeaserDecryption();
elseif (uservalue == v)
A.VigenereEncryption();
elseif (uservalue == V)
A.VigenereDecryption();
elseif (uservalue == q)
cout << " Exiting encrypt/decrypt program" << endl;
else
A.SubMenu();
}
char AList::SubMenu(){
char uservalue;
cout << "Valid commands are :" << endl
<<" m enter a new current message from the keyboard/n"
<<" c encrypt the current message using the ceaser cypher/n"
<<" C decrypt the current message using the ceaser cypher/n"
<<" v encrypt the current message using the vigenere"
<<" cypher/n"
<<" V decrypt the current message using the vigenere"
<<" cypher/n"
<<" h show this help menu/n"
<<" q quit the program" << endl << endl;
uservalue = ReadElement();
return uservalue;
}
char AList::ReadElement(){ //this is part of a method i used in
//another porgram, i dont know how to
//change it to fit this program
while (!cin.good()){
cin.clear();
cin.ignore(80,’\n’);
}
return num;
}
string AList::GetPlainTxt(){
}
string AList::GetKey(){
}
string AList::CeaserEncryption(){
}
string AList::CeaserDecryption(){
}
string AList::VigenereEncryption(){
}
string AList::VigenereDecryption(){
For ReadElement() you really need to read the char:
1 2 3 4 5 6 7 8 9 10 11 12 13
char AList::ReadElement(){ //this is part of a method i used in
//another porgram, i dont know how to
//change it to fit this program
while (!cin.good()){
cin.clear();
cin.ignore(80,’\n’);
}
char num;
cin >> num;
return num;
}