I seen another post on here about encryption and I thought I would try my hand at some XOR stuff. I had it perfect but know I want to add in the chance for people to write in the txt they want to be encrypted. I had that working but afterit decrypted the txt there was still a bunch of mubly jumbly after it. So I decided I wanted to clean it up. This is what I got. The comments explain where the errors are at and what they are.
Code:
#include <iostream.h>
#include <stdlib.h>
#include <string.h>
int main()
{ char a[501];
char b[502]="dmj7HaL(*EjJNuh88iNU67Jbn76n75hu767Bhg567b765mdsd4s";
char c[501];
int leg;
int g=0,h=0;
cout<<"\nPlease Input Some Text To Be Encrypted\n\n";
cin.getline(a,502);
strlen(a)=leg;//problem here I want "leg" to equal the length of "a" "non-lvalue in assignment error"
while(g<leg)
{
for(int x=0, x<502, x++)//parse error before")" here
{
c[x]=b[x]^a[x];
cout<<c[x];} //parse error before "}" here
g++;
}
cout<<"\n\nYour Decrypted Text\n\n"; }
while(h<leg)
{
for(int x=0, x<502, x++) //parse error before ")" here
{
a[x]=b[x]^c[x];
cout<<a[x];
} //parse error before "}" here
h++;
}
cout<<"\n\n";
system("PAUSE");
return 0;
} //parse error at the end of input here. There is also a "no8" error on line 14 of a source I don't have open call'd ß