Cipher program

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


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

const int MLS = 50;
typedef char 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();

       else if(uservalue == m)
             cout << "Hmm...";

       else if (uservalue == c)
             A.CeaserEncryption();

       else if (uservalue == C)
             A.CeaserDecryption();

       else if (uservalue == v)
             A.VigenereEncryption();

       else if (uservalue == V)
             A.VigenereDecryption();

       else if (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(){
No one to help???
line 48 and following: you have to compare with a constant literal. What you're doing is comparing with a non existing variable. i.e. write
1
2
3
4
if(uservalue == 'h') // Note: ''
...
else if(uservalue == 'm')
...


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;
       }
GetPlainTxt():
1
2
3
4
5
6
7
8
9
string AList::GetPlainTxt(){
       while (!cin.good()){
              cin.clear();
              cin.ignore(80,’\n’);
       }
string result;
getline(cin, result);
return result;
       }
get the drift?

the encryption and decryption is not hard. Look at this:

http://en.wikipedia.org/wiki/Caesar_cipher
http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher
Topic archived. No new replies allowed.