-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUser.hpp
More file actions
43 lines (42 loc) · 748 Bytes
/
User.hpp
File metadata and controls
43 lines (42 loc) · 748 Bytes
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
#include <iostream>
#include <map>
using namespace std;
int state;
class User
{
private:
string password;
public:
string name;
void init(string n, string p)
{
name = n;
password = p;
}
// 登出
void logout()
{
state = 0;
}
// 返回是否登陆成功
bool login()
{
std::cout << "Password: ";
std::cout.flush();
std::string pwd;
std::cin >> pwd;
if (pwd == password)
{
return true;
}
else
{
return false;
}
}
void show()
{
std::cout << "[" << name << "]:";
}
}user[10];
std::map<std::string, int> mp;