I have wrote this program in C++. But it doesnt have the output that it should. Instead of putting out +-++-+ it puts out ++-+++-+++++++-+++-+++--+++. That is just an example it will ofcourse have defirent output but it makes more characters then there is in the origanal string when i uncrypt the encrypted. If you could please post fix for this program I will apreciate it.
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int main()
{
string line;
char key = 'x'
string encrypted;
char infile[20];
char outfile[20];
cout<<"File for input: ";
cin.getline(infile, 19);
cout<<"File for output: ";
cin.getline(outfile[100];
ifstream file1(infile);
ofstream file2;
file2.open(outfile, ios::app);
if(file1.is_open());
{
while(file1.good())
{
getline(file1, line);
for(int i = 0; i < line.size(); i++)
{
encrypted += line[i] ^ (int(key)+i)
}
file2<<encrypted;
}
}
file2.close()
return 0;
}
Thank you.
:?: