-
Notifications
You must be signed in to change notification settings - Fork 0
/
filemanager.cpp
66 lines (56 loc) · 1.42 KB
/
filemanager.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
63
64
65
66
// filemanager.cpp: implementation of the filemanager class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "restaurant.h"
#include "filemanager.h"
#include <fstream>
#include "table.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
int filemanager::count = 0;
filemanager::filemanager()
{
}
filemanager::~filemanager()
{
}
void filemanager::csave(customer c)
{
int i;
filemanager::count++;
ofstream out;
ifstream in("table.txt",ios_base::in);//改变餐桌状态为不可预订
table T[50];
for(i = 0;i<50;i++)
{
T[i].tbnum = in.get();
T[i].state = in.get();
T[i].people = in.get();
}
in.close();
T[c.tnum].state = 0;
ofstream outc("table.txt",ios_base::out);
for(i = 0;i<50;i++)
{
outc<<T[i].tbnum<<" "<<T[i].state<<" "<<T[i].people<<" "<<endl;
}
outc.close();
out.open("customer.txt",ios_base::out||ios_base::app);
out<<c.name<<" "<<c.time<<" "<<c.tnum<<" "<<c.phone<<" "<<c.people<<" "<<c.note<<" "<<endl;//将客户信息保存到文件中
out.close();
}/*
void filemanager::removec(customer);
void tablesave();
void tableread();
void cread();
void csave();
void csearchname(string names);
void csearchtable(int tnums);
void csearchphone(long phones);*/