-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuanLi_Sach.cpp
62 lines (56 loc) · 1.29 KB
/
QuanLi_Sach.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
55
56
57
58
59
60
61
62
#include "stdafx.h"
#include"Help_tk.h"
#include "QuanLi_Sach.h"
#include "Sach.h"
void QuanLi_Sach::readFile(string path)
{
fstream fs;
fs.open(path, ios::in);
if (fs.fail())
{
cout << "File not exit" << endl;
}
else
{
while (!fs.eof())
{
string n;
getline(fs,n);
Sach ps(n);
VT.push_back(ps);
}
fs.close();
}
}
void QuanLi_Sach::writeFile(string path2)
{
fstream fs;
fs.open(path2, ios::out);
if (fs.fail()) cout << "file is not exits";
else {
for (int i = 0; i<VT.size(); i++)
fs << VT[i];
}
fs.close();
}
Sach QuanLi_Sach::get(int i)
{
return VT[i];
}
int QuanLi_Sach::size()
{
return VT.size();
}
void QuanLi_Sach::Search(System::Windows::Forms::DataGridView ^ G, System::String ^ path)
{
Help_tk help;
for(int i=0;i<VT.size();i++)
if (VT[i].getMasach().compare(help.toStandardString(path))==false) {
System::String ^a = help.convertstringToString(VT[i].getMasach());
System::String ^b = help.convertstringToString(VT[i].getTensach());
System::String ^c = help.convertstringToString(VT[i].getSoluong());
System::String ^d = help.convertstringToString(VT[i].getTinhtrang());
System::String ^e = help.convertstringToString(VT[i].getNgonngu());
G->Rows->Add(a, b, c, d, e);
}
}