I'm making a small password system (*very* low tech, any dipshit can crack it). So, the user inputs some random text in, but I don't know which variable to use for this. Oh, and it gets stored into a file.
Do I use a string? *I tried this, but it only stores one word.
int(now that would be a pathetic attempt)?
What variable type do I use?
Cheers to anyone who can help!
...
Cheers!
#include <iostream>
#include <fstream>
#include <cstdio>
#include <sstream>
#include <cstdlib>
usingnamespace std;
string username;
string password;
string secret; //What variable?
fstream data("data.txt");
fstream text("stuff.txt");
void explain()
{
cout <<"\tCreate a username and password first. Note, when\n"
<<"\ta new set is created, it replaces the old one.\n"
<<"\t(still working on it!) and that this uses the stupidest\n"
<<"\tform of security ever created. DO NOT STORE CONFIDENTIAL\n"
<<"\tSTUFF because any baffoon can crack this system. Also, you\n"
<<"\tcan't make a username including spaces, as the program glitches badly.\n"
<<"\t--PS: you can only store text.--\n\n\n";
return;
}
void create()
{
cout <<"Username: ";
cin >> username;
data <<"USERNAME: " <<username;
data << endl;
cout <<endl;
cout <<"Password: ";
cin >> password;
data <<"PASSWORD: " <<password;
data << endl;
cout <<endl;
return;
}
void secrettext()
{
cout<<"Enter your secret text: ";
cin>> secret; //The variable gets stored
text<< secret; //here...
}
int main(int nNumberofArgs, char* pszArgs[])
{
explain();
create();
secrettext();
system("PAUSE");
return 0;
}
oh, and i would like to find a way to make c++ not overwrite a file's contents. so it would display the text according to the username and pass.