Encrypting for the first time

I am currently studying at college C++ and we pretty much covered everything there is in terms of Procedural Programming. Now we are moving into stuff like SDL, displaying images, etc. But i wanted to take things further and make some sort of encryption system. the most basic possible one that you can think of, and maybe then make it into a proper program. Anyway to the main point...this is what i have so far

#include <iostream>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <string>
#include <cctype>

using namespace std;
void Encrypt( char LOL);
void Decrypt( char LOOL);
int a = 0;

int main()
{
char LOL;
cout<<"Please enter something"<<endl;
cin>>a;
Encrypt(LOL);

cout<< "Encrypted" << char(LOL) <<endl;
cout<< "decrypted" << char(LOL) << endl;

return 0;
}

void Encrypt ( char LOL[])
{
for ( int i=0; LOL[i] !='\0'; ++i) ++LOL[i];

}

void Decrypt (char * LOOL)
{
for (; *LOOL !='\0'; * LOOL ) --(*LOOL);
}

i keep getting errors like :
1. unresolved external symbol "void__cdecl Encrypt(char)" (?Encrypt@@YAXD@Z) referenced in function_main
2. 1 unresolved externals

any way to fix??? also it would be great if i could get some pointers where to start...from the bottom and have it related with the stuff im doing atm.

Thank You
you have definitions for:

void Encrypt(char LOL);

and

void Decrypt(char LOOL);


but different implements that do not match these definitions above.

You have implementations instead for:
void Encrypt(char LOL[])
{
...
}

and

void Decrypt(char * LOOL)
{
....
}

That is why you are getting a link error.
Looks like you should change your function definitions to match your implementation. Then also pass LOL as a char array for main instead of a char.
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
#include <iostream>
using namespace std;

void Encrypt(char * LOL)
{
    for(int i = 0; LOL[i] != '\0'; ++i)
        ++LOL[i];
}

void Decrypt(char * LOOL)
{
    for(int i = 0; LOOL[i] != '\0'; ++i)
        --LOOL[i];
}

int main()
{
    char LOL[512];
    cout << "Please enter something" << endl;
    cin >> LOL;

    Encrypt(LOL);
    cout<< "Encrypted : " << LOL << endl;
    Decrypt(LOL);
    cout<< "Decrypted : " << LOL << endl;

    return 0;
}
Topic archived. No new replies allowed.