This encrypter only has problems when your message has a space in it:
Code:
#include <iostream.h>
#include <fstream.h>
int main()
{
char string[257], note2[257];
int b;
ofstream a_file("note.txt", ios::trunc);
cout<<"Write your note:"<<endl;
cin.getline(string, 256, '\n');
cout<<"loading..."<<endl;
for(int a=0;a<strlen(string);a++)
{
b=(int)string[a];
note2[a]=(char)(b+39);
}
a_file<<note2;
a_file.close();
cout<<"Your note is now encrypted into the file: 'note.txt'"<<endl;
cin.get();
return 0;
}
and here is the decrypter:
Code:
#include <iostream.h>
#include <fstream.h>
int main()
{
char string[257], note2[257];
int b;
ifstream b_file("note.txt");
b_file>>string;
cout<<"'Note.txt' is now being decrypted.\nPlease wait..."<<endl;
for(int a=0;a<strlen(string);a++)
{
b=(int)string[a];
note2[a]=(char)(b-39);
}
cout<<note2<<endl;
b_file.close();
cin.get();
return 0;
}
Please tell me if anything is wrong.
Thanks,
-KaibaFan321