-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSM.cpp
54 lines (43 loc) · 814 Bytes
/
SM.cpp
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
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void reg()
{
string username, password;
ofstream fout;
cout << "username $ ";
cin >> username;
cout << "password $ ";
cin >> password;
fout.open(username + ".txt");
fout << username << "\n" << password;
}
int main(int argc, char *argv[])
{
int c;
cin >> c;
if(c == 1) { reg(); }
else if(c == 2)
{
string us, pw;
string username, password;
ifstream fin;
cout << "username $ ";
cin >> username;
cout << "password $ ";
cin >> password;
fin.open(username + ".txt");
fin >> us;
fin >> pw;
if(username == us && password == pw)
{
cout << "welcome";
}
else
{
cout << " $";
}
}
return 0;
}