,  ,

++

> > >

 
 
 
saharok2000
1 / 1 / 0
: 01.07.2014
: 49
#1

- C++

01.07.2014, 20:11. 706. 15
( )

! : , .
( ), . :
C++
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
using namespace std;
 
ifstream* openFile()
{
    ifstream* pFileStream = 0;
    for(;;)
    {
        char fileName[50] = {'l', 'o', 'g', 'i', 'n', 's', '_', 'p' ,'a', 's', 's', 'w', 'o', 'r', 'd', 's', '.', 't', 'x', 't'};
        //îòêðûâ*åì ô*éë äëÿ ÷òå*èÿ
        //*å ñîçä*â*òü, åñëè *å ñóùåñòâóåò
        pFileStream = new ifstream(fileName);
        if (pFileStream->good())
        {
            break;
        }
        cerr << "  . " << fileName << endl;
        delete pFileStream;
    }
    return pFileStream;
}
 
int register_()
{
    char login[40];
    char password[40];
    char theLogPass[100];
    cout << "  " << endl;
    cout << "->";
    cin >> login;
    cout << "  " << endl;
    cout << "->"; 
    cin >> password;
    theLogPass[100] = login[40] + password[40];
    // ç*ïèñü ä***ûõ
    ofstream fout("logins_passwords.txt", ios::app);
    fout << theLogPass;
    fout << endl;
    fout.close();
    cout << "  !!!" << endl;
}
 
int loginer()
{
    char the_log[40];
    char the_pass[40];
    char the_log_pass[100];
    cout << "  " << endl;
    cout << "->";
    cin >> the_log;
    cout << " " << endl;
    cout << "->";
    cin >> the_pass;
    the_log_pass[100] = the_log[40] + the_pass[40];
    cout << the_log_pass << endl;
    
    //ïîëó÷å*èå ô*éëîâîãî ïîòîê*
    ifstream* pFileStream = openFile();
    
    //îñò**îâèòñÿ ïî äîñòèæå*èþ êî*ö* ô*éë*
    while (!pFileStream->eof())
    {
        //÷òå*èå ç**÷å*èÿ
        char value[100];
        (*pFileStream) >> value;
        
        // îñò**îâê* ïðè îøèáêå ÷òå*èÿ
        //(**ïðèìåð, ñ÷èòûâ*åòñÿ *å öåëîå ÷èñëî, èëè
        //ñ÷èò** ñèìâîë *îâîé ñòðîêè ïîñëå êîòîðîãî 
        //*è÷åãî *åò
        if (pFileStream->fail()){
            break;
        }
        //âûâîä ñ÷èò***îãî ç**÷å*èÿ
        if(value == the_log_pass){
            cout << " " << endl;
        }else{
            cout << " !!!" << endl;
        }
    }
    delete pFileStream;
}
 
 
 
int main ()
{
    setlocale(LC_ALL, "");
    string v_log = "login";
    string v_reg = "register";
    string otvet;
    
    cout << "!!! \n   " 
    << " ." << endl;
    cout << " login    register  ." << endl;
    cout << "->";
    cin >> otvet;
    
    if(otvet == v_log){
        loginer();
    }
    if(otvet == v_reg){
        register_();
    }
    system("pause");
    return 0;
}
.
0
? .
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
01.07.2014, 20:11
! (C++):

- C++
! , : , ...

- C++
?

- C++
dll . ?

- C++
. , (), . . #include &lt;iostream&gt; ...

win api - C++
(feof ) . ...

- C++
...

15
zss
 ++
6530 / 6092 / 2007
: 18.12.2011
: 15,843
: 1
01.07.2014, 20:19 #2
saharok2000
the_log_pass[100] = the_log[40] + the_pass[40];
?
string.
char
C++
1
2
strcpy(the_log_pass,the_log);
strcat(the_log_pass,the_pass)
0
Kerry_Jr
 PHP
2206 / 2002 / 701
: 14.05.2014
: 5,867
: 1
: 5
01.07.2014, 20:21 #3
saharok2000
char fileName[50] = {'l', 'o', 'g', 'i', 'n', 's', '_', 'p' ,'a', 's', 's', 'w', 'o', 'r', 'd', 's', '.', 't', 'x', 't'};
,
0
saharok2000
1 / 1 / 0
: 01.07.2014
: 49
01.07.2014, 20:38  [] #4
zss, .
Kerry_Jr, , .

6
zss,
[Error] 'strcpy' was not declared in this scope
0
nmcf
5533 / 4843 / 1641
: 14.04.2014
: 19,647
01.07.2014, 20:44 #5
<cstring>.
0
saharok2000
1 / 1 / 0
: 01.07.2014
: 49
01.07.2014, 20:46  [] #6
nmcf
<cstring>.
,
0
Kerry_Jr
 PHP
2206 / 2002 / 701
: 14.05.2014
: 5,867
: 1
: 5
01.07.2014, 21:03 #7
saharok2000
, .
, , . .
C++
1
char fileName[50] = "logins_passwords.txt";
, , .
1
saharok2000
1 / 1 / 0
: 01.07.2014
: 49
01.07.2014, 21:14  [] #8
Kerry_Jr, string;

C++
1
2
string fileName = "logins_passwords.txt";
pFileStream = new ifstream(fileName);

C++
1
pFileStream = new ifstream("logins_passwords.txt");
0
nmcf
5533 / 4843 / 1641
: 14.04.2014
: 19,647
01.07.2014, 21:17 #9
new?
C++
1
ifstream ifs(fileName);
0
recoder
130 / 130 / 28
: 13.09.2013
: 260
: 2
01.07.2014, 21:17 #10
C++
1
std::ifstream inFile(filename);


C++
1
2
3
4
5
std::cin.getline(filename, SIZE);
std::ifstream inFile;
inFile.open(filename);
if ( !inFile.is_open() )
{ ... }
0
saharok2000
1 / 1 / 0
: 01.07.2014
: 49
01.07.2014, 21:28  [] #11
C++
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
#include <cstring>
using namespace std;
 
ifstream* openFile()
{
    ifstream* pFileStream = 0;
    for(;;)
    {
        char fileName[50] = {'l', 'o', 'g', 'i', 'n', 's', '_', 'p' ,'a', 's', 's', 'w', 'o', 'r', 'd', 's', '.', 't', 'x', 't'};
        //îòêðûâ*åì ô*éë äëÿ ÷òå*èÿ
        //*å ñîçä*â*òü, åñëè *å ñóùåñòâóåò
        pFileStream = new ifstream(fileName);
        if (pFileStream->good())
        {
            break;
        }
        cerr << "Íåâîçìîæ*î îòêðûòü ô*éë " << fileName << endl;
        delete pFileStream;
    }
    return pFileStream;
}
 
int register_()
{
    char login[40];
    char password[40];
    char theLogPass[100];
    cout << "Ïðèäóì*éòå ëîãè* " << endl;
    cout << "->";
    cin >> login;
    cout << "Ïðèäóì*éòå ï*ðîëü " << endl;
    cout << "->"; 
    cin >> password;
    strcpy(theLogPass,login);
    strcat(theLogPass,password);
 
    // ç*ïèñü ä***ûõ
    ofstream fout("logins_passwords.txt", ios::app);
    fout << theLogPass;
    fout << endl;
    fout.close();
    cout << "Âû óñïåø*î ç*ðåãèñòðèðîâ**û!!!" << endl;
}
 
int loginer()
{
    char the_log[40];
    char the_pass[40];
    char the_log_pass[100];
    cout << "Ââåäèòå ñâîé ëîãè*" << endl;
    cout << "->";
    cin >> the_log;
    cout << "Ââåäèòå ï*ðîëü" << endl;
    cout << "->";
    cin >> the_pass;
    strcpy(the_log_pass,the_log);
    strcat(the_log_pass,the_pass);
    cout << the_log_pass << endl;
    
    //ïîëó÷å*èå ô*éëîâîãî ïîòîê*
    ifstream* pFileStream = openFile();
    
    //îñò**îâèòñÿ ïî äîñòèæå*èþ êî*ö* ô*éë*
    while (!pFileStream->eof())
    {
        //÷òå*èå ç**÷å*èÿ
        char value[100];
        (*pFileStream) >> value;
        
        // îñò**îâê* ïðè îøèáêå ÷òå*èÿ
        //(**ïðèìåð, ñ÷èòûâ*åòñÿ *å öåëîå ÷èñëî, èëè
        //ñ÷èò** ñèìâîë *îâîé ñòðîêè ïîñëå êîòîðîãî 
        //*è÷åãî *åò
        if (pFileStream->fail()){
            break;
        }
        //âûâîä ñ÷èò***îãî ç**÷å*èÿ
        if(value == the_log_pass){
            cout << "Äîñòóï ð*çðåøå*" << endl;
        }else{
            cout << "Îøèáê* *ó*òåôèê*öèè!!!" << endl;
        }
    }
    delete pFileStream;
}
 
 
 
int main ()
{
    setlocale(LC_ALL, "");
    string v_log = "login";
    string v_reg = "register";
    string otvet;
    
    cout << "Ïðèâåò ÷åëîâåê!!! \n×òîáû ïîï*ñòü â ìèð êîìïüþòåð* " 
    << "*åîáõîäèìî âîéòè èëè ç*ðåãèñòðèðîâ*òüñÿ." << endl;
    cout << "Ââåäèòå login ÷òîáû âîéòè èëè register äëÿ ðåãèñòð*öèè." << endl;
    cout << "->";
    cin >> otvet;
    
    if(otvet == v_log){
        loginer();
    }
    if(otvet == v_reg){
        register_();
    }
    system("pause");
    return 0;
}
0
nmcf
5533 / 4843 / 1641
: 14.04.2014
: 19,647
01.07.2014, 21:43 #12
82- - , strcmp(). . string, , .
0
saharok2000
1 / 1 / 0
: 01.07.2014
: 49
01.07.2014, 21:52  [] #13
nmcf
82- - , strcmp(). . string, , .
- ( )
0
nmcf
5533 / 4843 / 1641
: 14.04.2014
: 19,647
01.07.2014, 21:54 #14
C++
1
if(strcmp(value, the_log_pass))
1
saharok2000
1 / 1 / 0
: 01.07.2014
: 49
02.07.2014, 19:41  [] #15
nmcf,

21 36
, ... 82
C++
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
#include <cstring>
using namespace std;
 
ifstream* openFile()
{
    ifstream* pFileStream = 0;
    for(;;)
    {
        char fileName[50] = {'l', 'o', 'g', 'i', 'n', 's', '_', 'p' ,'a', 's', 's', 'w', 'o', 'r', 'd', 's', '.', 't', 'x', 't'};
        //îòêðûâ*åì ô*éë äëÿ ÷òå*èÿ
        //*å ñîçä*â*òü, åñëè *å ñóùåñòâóåò
        pFileStream = new ifstream(fileName);
        if (pFileStream->good())
        {
            break;
        }
        cerr << "Íåâîçìîæ*î îòêðûòü ô*éë " << fileName << endl;
        delete pFileStream;
    }
    return pFileStream;
}
 
int register_()
{
    char login[40];
    char password[40];
    char theLogPass[100];
    cout << "Ïðèäóì*éòå ëîãè* " << endl;
    cout << "->";
    cin >> login;
    cout << "Ïðèäóì*éòå ï*ðîëü " << endl;
    cout << "->"; 
    cin >> password;
    strcpy(theLogPass,login);
    strcat(theLogPass,password);
 
    // ç*ïèñü ä***ûõ
    ofstream fout("logins_passwords.txt", ios::app);
    fout << theLogPass;
    fout << endl;
    fout.close();
    cout << "Âû óñïåø*î ç*ðåãèñòðèðîâ**û!!!" << endl;
}
 
int loginer()
{
    char the_log[40];
    char the_pass[40];
    char the_log_pass[100];
    cout << "Ââåäèòå ñâîé ëîãè*" << endl;
    cout << "->";
    cin >> the_log;
    cout << "Ââåäèòå ï*ðîëü" << endl;
    cout << "->";
    cin >> the_pass;
    strcpy(the_log_pass,the_log);
    strcat(the_log_pass,the_pass);
    cout << the_log_pass << endl;
    
    //ïîëó÷å*èå ô*éëîâîãî ïîòîê*
    ifstream* pFileStream = openFile();
    
    //îñò**îâèòñÿ ïî äîñòèæå*èþ êî*ö* ô*éë*
    while (!pFileStream->eof())
    {
        //÷òå*èå ç**÷å*èÿ
        char value[100];
        (*pFileStream) >> value;
        
        // îñò**îâê* ïðè îøèáêå ÷òå*èÿ
        //(**ïðèìåð, ñ÷èòûâ*åòñÿ *å öåëîå ÷èñëî, èëè
        //ñ÷èò** ñèìâîë *îâîé ñòðîêè ïîñëå êîòîðîãî 
        //*è÷åãî *åò
        if (pFileStream->fail()){
            break;
        }
        //âûâîä ñ÷èò***îãî ç**÷å*èÿ
        if(strcmp(value, the_log_pass)){
            cout << "Äîñòóï ð*çðåøå*" << endl;
        }else{
            cout << "Îøèáê* *ó*òåôèê*öèè!!!" << endl;
            cout << "value        = " << value << endl;
            cout << "the_log_pass = " << the_log_pass << endl;
            
        }
    }
    delete pFileStream;
}
 
 
 
int main ()
{
    setlocale(LC_ALL, "");
    string v_log = "login";
    string v_reg = "register";
    string otvet;
    
    cout << "Ïðèâåò ÷åëîâåê!!! \n×òîáû ïîï*ñòü â ìèð êîìïüþòåð* " 
    << "*åîáõîäèìî âîéòè èëè ç*ðåãèñòðèðîâ*òüñÿ." << endl;
    cout << "Ââåäèòå login ÷òîáû âîéòè èëè register äëÿ ðåãèñòð*öèè." << endl;
    cout << "->";
    cin >> otvet;
    
    if(otvet == v_log){
        loginer();
    }
    if(otvet == v_reg){
        register_();
    }
    system("pause");
    return 0;
}
0
02.07.2014, 19:41
MoreAnswers
37091 / 29110 / 5898
: 17.06.2006
: 43,301
02.07.2014, 19:41
! :

? - C++
, 3 . , include. , main.cpp: #include...

! - C++
, ...

dll Linux - C++
Windows DLL BOOL WINAPI DllMain(...), Linux? ...

- C++
, . , ...




:
15

- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
@Mail.ru