Need assistance with making a password system(PLEASE ANSWER?).

Hello again! Right now, I'm trying to make a password system that stores and tries to protect a piece of text with a user created user & password set. this set and the text is stored in a file called a1.ran. Now, as a second part of the project, I have to make a program that checks a1.ran for a known user set and displays the text according to it. I have NO idea where to start. Anyone help me and kindly provide a code that obeys these rules? I will tweak the code according to it. BIG thanks for anyone that helps me.

CHEERS!

Here's the code for the password creator (updated)for reference:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <iostream>
#include <fstream>
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <string>

using namespace std;

string username;
string password;
char szstring[500];                              //What variable?


void explain()
{
    cout <<"\tCreate a username and password first. Note, when\n"
         <<"\ta new set is created, make sure that you have not created\n"
         <<"\tthe username before, and that this uses the stupidest\n"
         <<"\tform of security ever created. DO NOT STORE CONFIDENTIAL\n"
         <<"\tSTUFF because any baffoon can crack this program. 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()
{
    ofstream data;


    cout <<"Username: ";
    cin >> username;
    data.open("a1.ran", fstream::in|fstream::app);
    data <<"USERNAME: " <<username;
    data << endl;
    cout <<endl;
    data.close();


    cout <<"Password: ";
    cin >> password;
    data.open("a1.ran", fstream::in|fstream::app);
    data <<"PASSWORD: " <<password;
    data << endl
         << endl;
    cout <<endl;
    data.close();
    return;
}
void secrettext()
{
    ofstream data;
    cout<<"Enter your secret text (type in # first and continue typing): ";
    cin>> szstring[500];
    cin.getline(szstring, 500);
    data.open("a1.ran", fstream::in | fstream::app);  //The variable gets stored
    data<<szstring;                                                        //here...
    data<< "\n\n\n"
        << "--------------------------------------------------------------------------------------------------------------------------------------------------------------------"
        << endl;
    data.close();
    cout<<"\n\n\nSaving...100%\n";
    cout<<"\n\nSaved.";

    return;
}

int main(int nNumberofArgs, char* pszArgs[])
{

    explain();
    create();
    secrettext();

    system("PAUSE");

    return 0;

}


I also like help about a bug: When the secret text is written, the first letter always disappears from the file(If I enter 'this', in the file it shows up as 'his').





Toodles!
Last edited on
Topic archived. No new replies allowed.