Hi, I need help with something I'm working on. I just want to get a basis to start, but I'm hoping to end up with a system where I can store encrypted output in an outside file. Right now my algorithms are a little elementary to consider even stable, but I'm just working on this one program. :cheesy: The objective is to take a persons input (username=uname) and (password=pword), take them and convert them to int and output them in a file. The next step is to open that file, read it line by line, store it in an array, and display the letter the int stands for (example file out would be 98, thus translated back it would be 'a'). Here's what I have so far.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
int main(void)
{
char uname[30];
char pword[30];
char fname[34];
char q;
int x;
int y;
char *stuff=okay;
char okay[30];
ofstream myfile;
ifstream file2;
z=0;
cout << "Please enter your username: ";
cin >> uname;
myfile.open("temp.txt", ios:: out);
myfile << uname << ".txt";
myfile.close();
cout << "\nPlease enter your password: ";
cin >> pword;
file2.open("temp.txt", ios::in);
file2 >> fname;
file2.close();
myfile.open(fname, ios::ate);
for (x=0; x < strlen(pword); x++)
{
q = pword[x];
y = int(q);
cout << "\n" << y;
myfile << y << "\n";
}
myfile.close();
for (x=0; x <strlen(pword); x++)
{
file2.open(fname, ios::in);
file2.getline(stuff, 3);
file2.close();
cout << (char)okay;
}
fflush(stdin);
getchar();
return(0);
}
Help is appreciated, thanks.