-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVT_Account.cpp
More file actions
60 lines (54 loc) · 1.12 KB
/
VT_Account.cpp
File metadata and controls
60 lines (54 loc) · 1.12 KB
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
#include"stdafx.h"
#include "VT_Account.h"
#include"Account.h"
int vt_account::Size()
{
return V.size();
}
void vt_account::readfile()
{
fstream f;
f.open("account_tk.txt", ios::in);
if (f.fail()) cout << "file is not exits";
else {
while (!f.eof()) {
string s;
getline(f, s);
account p(s);
V.push_back(p);
}
}
f.close();
}
void vt_account::writefile()
{
fstream f;
f.open("AccountSelect_tt.txt", ios::out);
if (f.fail()) cout << "file is not exits";
else {
for (int i = 0; i<V.size(); i++)
f<< V[i];
}
f.close();
}
account vt_account::get(int i) {
return V[i];
}
bool vt_account::check(string user, string pass)
{
for (int i = 0; i < V.size(); i++)
if (V[i].getuser() == user&&V[i].getpassword() == pass)
return true;
return false;
}
void vt_account::Dislay()
{
for (int i = 0; i < V.size(); i++)
cout << "User: " << V.at(i).getuser()<<"\tPass:"<<V.at(i).getpassword()<<endl;
}
void vt_account::set(string s1,string s2)
{
for (int i = 0; i < V.size(); i++)
if (V[i].getuser() == s1)
V[i].getpassword() =s2;
}