Hi all. I was wanting to write a simple "password keeper" program to hide passwords to my various online accounts. The concept is that the user enters the password as a character array of a user-determined length,and the filename is the account. It takes the array, switches it over to type int and adds a "key" to generate the encrypted (if you can even call it that) password. This is the code:
#include <iostream>
#include <cstdlib>
#include <fstream>
usingnamespace std;
int main()
{
int length;
cout<<"Enter length of password in letters.\n";
cin>>length;
int carryint[length];
char filename[50];
char input[length];
int counter=0;
int key;
char carry;
cout<<"Next, enter the filename to write to\n ";
cin>>filename;
cout<<"Now, enter the key\n";
cin>>key;
cout<<"Now, enter the password to encrypt\n";
cin>>input;
do
{
input[counter]=carry;
carryint[counter]=(int)carry+key;
counter++;
}
while (counter<=length);
cout<<"The output is:\n"<<carryint;
ofstream out (filename);
out<<carryint;
out.close();
}
problem is, the output to the file is always something like ''>>>>>>>>>''
and the program gives me what appears to be a memory location as "carryint"