I'm hoping someone can give me some insight. I am very new to C++ programing and could use some guidance. I am trying to make a program to take a line of text from a file encrypt it and send it back to a file. Then, at the users request, get the encrypted code and decrypt it. I am not finished writing it, but I wanted to test what I have finished. I cannot get it to compile because of linking errors having to do with my user defined functions. I am writing this in MS VS 2010 (I have made sure that I chose the consol application).
int main ()
{
char run = 'y', choice = 'y';
char encryptMap [128];
char decryptMap [128];
int encryptMapLength = 0, decryptMapLength = 0;
string password;
string cryption;
string inText, outText;
ifstream inFile;
ofstream outFile;
do
{
cout << "Would you like to encrypt or decrypt a file?" << endl;
cout <<"If you would like to, enter ""Y"", if not enter ""Q"": ";
cin >> run;
run = tolower (run);
if (run == 'y')
{
cout << endl << "If you would like to encrypt a file enter ""E""" << endl;
cout << "If you would like to decrypt a file enter ""D""";
cout << endl << "Enter your selection: ";
cin >> choice;
choice = tolower (choice);
cout << endl;
if (choice == 'e')
{
cout << endl << "Enter the exact address of the file that you would like to encrypt" << endl;
cin >> inText;
inFile.open (inText);
getline (inFile, inText);
cout << """" << inText << """" << endl << "This will be encrytpted" << endl;
cout << endl << "Enter the exact address of the location for the file that you would " << endl
<< "like save the encyption to" << endl;
cin >> outText;
inFile.open (outText);
cout << "Enter a password to encrypt your file: ";
cin >> password;
encryptKeyMap (password, encryptMap [128], encryptMapLength);
outFile << outText;
}
if (choice == 'd')
{
cout << endl << "Enter the exact address of the file that you would like to decrypt" << endl;
cin >> inText;
inFile.open (inText);
getline (inFile, inText);
cout << """" << inText << """" << endl << "This will be decrytpted" << endl;
cout << endl << "Enter the exact address of the location for the file that you would " << endl
<< "like save the encyption to" << endl;
cin >> outText;
inFile.open (outText);
cout << "Enter your password to decrypt the file, the password must be the" <<
" same as the one used to encrypt the file: ";
cin >> password;
decryptKeyMap (password, decryptMap [128], decryptMapLength);
}
I'm still not tracking. I used void as the function type becuase there is more than one data type being passed, and i listed the data types of the variables that I am passing. I think my mistake must be with the string or character array, but I have no idea what I did wrong.
I have another problem now. I want to identify characters from a string as capitals, lowwer case, or other. I'm tryig to use the functions isupper and islower to change the value of a bool variable and perform a calculation depending on the true/false state of the bool function. But the state doesn't seem to ever change from true.
is that supposed to be your bool variables? the only thing could think of is that you think the isupper(char) function will overlap with your bool variable because you named it the same, but that isn't how it works.