//Encryption/decryption program that encrypts or decrypts
//user input as a string.
#include <iostream>
#include <string>
using namespace std;
string encrypt(string text, string message);
string decrypt(string text, string message);
char choice;
int main()
{
//Ask user to encrypt or decrypt
cout << "Would you like to encrypt or decrypt?" << endl;
cout << "Enter E for encrypt or D for decrypt." << endl;
cin >> choice;
if ((choice == 'E')||(choice == 'e'))
{
encrypt(string text, string message); //error point to here
}
else if ((choice == 'D')||(choice == 'd'))
{
decrypt(string text, string message); //error point to here
}
return 0;
}
//Encrypt the text
string encrypt(string text, string message);
{
int i;
string temp;
cout << "Enter the text you wish to encrypt." << endl;
cin >> text;
for (i = 0; i < message.length(); ++i)
temp += 3 + (text[i] - '0');
cout << "Encrypted text is " << temp << endl;
}
//Decrypt the text
string decrypt(string text, string message);
{
int i;
string temp;
cout << "Enter the text you wish to decrypt." << endl;
cin >> text;
for (i = 0; i < message.length(); ++i)
temp += 3 + (text[i] - '0');
cout << "Decrypted text is " << temp << endl;
}
error: expected primary-expression before "text"
error: expected primary-expression before "message"
Can guide me? Thanks in advance!