I will just comment in the code instead of correcting for you...
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
|
//Use a while statement around this switch that way if a return is never hit, it just loops back here
//This should look similar to the loop you have in main! for a simple menu, I believe that is better than recursion
//call getMenu()
switch (m)
{
case 'e':
case 'E':
{
return m;
break;
}
case 'd':
case 'D':
{
return m;
break;
}
case 'q':
case 'Q':
{
exit(0);
}
default:
{
cout << "\t--------------------------------------\n";
cout << "\n\t--- Invalid input: Please restart. ---\n\n";
cout << "\t--------------------------------------\n";
cout << endl;
displayMenu(); //Correct
getMenuChoice(); //not here, this makes it recursive, that can work but is unnecessary
break;
}
}
|
next
you declare these as such
1 2
|
void encryptionChoice (char []);
void decryptionChoice (char []);
|
but then define them as
1 2
|
void encryptionChoice (char code);
void decryptionChoice (char code);
|
the declaration and definition should match. Currently you are sending it a single char but declaring it to be an array of char.
Also, your functions are returning a value but that goes nowhere.
http://www.cplusplus.com/doc/tutorial/functions2/
but I will also explain, the way you have it, you need something to hold the returned value. I am going to assume you just want to work on a single char.
1 2 3
|
code = encrypt(code);
//
code = decrypt(code);
|
that way code is set to the returned value.
If you want to pass by reference, which means the parameter that you send in can be modified, then you need to
1 2 3
|
//declare
void encrypt(char& code);
void decrypt(char& code);
|
then in your definitions take out the return statements and just change the value of "code" directly.