📄 head.h
字号:
#ifndef HEAD_H_
#define HEAD_H_
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
class Date //日期
{
public:
int year;
int month;
int day;
Date(int dYear = 2000 ,int dMonth = 1 ,int dDay = 1):year(dYear),month(dMonth),day(dDay){}
int Getyear(){return year;}
int Getmonth(){return month;}
int Getday(){return day;}
~Date(){}
friend ostream & operator << (ostream & os,Date date);
};
class Rate //现行利率
{
private:
double dRate;
public:
void update(double current); //利率更新
Rate(double percent = 0.01):dRate(percent){} //构造函数
virtual ~Rate(){}
double GetRate(){return dRate;} //返回利率
};
class Telephone //手机交费
{
private:
char mobile[15];
double remain;
public:
char *TelNum(){return mobile;} //返回电话号码
double Getremain(){return remain;} //返回余额
Telephone(char *mMobile="00000000000",double rRemain=0)
{
strcpy(mobile,mMobile);
remain=rRemain;
}
void add(double a)
{
remain=remain+a;
cout<<"充值成功,当前余额为"<<remain<<endl;
}
};
class Account : public Rate //帐户信息
{
private:
char name[35]; //帐户姓名
double money; //本金
char ID[19]; //银行卡号或存折号码
char password[7]; //取款时需在密码器上输入6位密码
public:
Date LastDay;//最后存款日期
Telephone Tel;
Account * pointer; //链表指针
Account();
Account(char * mName , double mMon , char * mID , int mYear , int mMonth , int mDay ,char * mPass, Account * p , double mRate,Telephone tTel);
Account(char * mName , double mMon , char * mID , int mYear , int mMonth , int mDay ,char * mPass,char *mobile,double a);
~Account(){pointer = NULL;}
char * GetName(){return name;} //返回帐户名
double GetMon(){return money;} //返回本金
Date GetDay(){return LastDay;} //返回最后存款日期
char* GetID(){return ID;} //返回ID
char * GetPass(){return password;} //返回密码
void ChaPass(char pass[7]){strcpy(password,pass);}//修改密码
void ChaMon(double mon){money = mon;} //更新存款
void ChaDate(Date day){ LastDay = day;} //更新时间
void UpdatePro(); //利润更新
};
class Enter //职员信息
{
private:
char NuM[10];
char pass[7];
Rate rate;
public:
Enter *pointer;
Enter(){
strcpy(pass,"123456");
strcpy(NuM,"000");
pointer=NULL;
}
Enter(char num[10],char password[7],Enter *p )
{
strcpy(NuM,num);
strcpy(pass,password);
pointer=p;
}
Enter(char num[10],char password[7])
{
strcpy(NuM,num);
strcpy(pass,password);
}
void Change(char password[7]) { strcpy(pass , password); }
char * Getpass(){return pass;}
char *Getnum(){return NuM;}
};
class Manager //经理信息
{
private:
char pass[7];
public:
Manager(){ strcpy(pass,"123456"); }
Manager(char password[7] ){ strcpy(pass,password); }
void Change(char password[7]) { strcpy(pass , password); }
char * Getpass(){return pass;}
};
int ComeIn(); //进入模式
void Customer(); //顾客模式
bool Clerk(); //职员模式
bool manager(); //经理模式
Enter * ChangeEnter(Enter * & cpass); //修改管理员进入密码
bool protect(Account * inewP); //密码保护
void ChangDay(Date & date); //更新日期
Account * Add(); //添加帐户
Account * Find(Account * ihead); //寻找帐户
Account * ProFind(); //寻找帐户(若是空列表则选择添加新帐户,或以后添加)
Account * Withdraw(Account * person); //帐户取款
Account * Deposit(Account * dperson); //帐户存款
Account * Charge(Account * dperson); //手机交费
void UpdateRate(); //利率更新
Account * Adjust(Account * newP); //修改密码
bool DisplayAcc(Account * newP); //帐户查询
void DisplayRate(); //利率查询
Account * Transfer(Account * outper ); //用户转帐
bool Delet(Account * head); //清除帐户
bool show(Account * head); //显示所有帐户信息
bool protect(Enter * inewP); //密码保护
Enter * Addclerk();
Enter * Find(Enter * ihead); //寻找管理员的基础函数
Enter * proFind(); //寻找管理员
bool Adjust(Enter * newP); //修改管理员密码
bool Delet(Enter * & head); //清除帐户
bool Changemanager(); //修改经理进入密码
bool Delet(Enter * head); //清除帐户
Account *ReadFile(); //读取用户文件并返回用户文件中链表的head
void FileCustomer(Account *pnewP,Account *head); //将最新用户信息写入文件
void FileCustomer2(Account *); //将删除后的用户信息写入文件
Enter * ReadFile1(); //读取职员文件并返回职员文件中链表的head
void FileClerk(Enter *,Enter *); //将最新职员信息写入文件
double rate(); //将利率写入文件
char * Password(); //读取存有经理密码的文件并返回密码
void FileClerk1(Enter *head); //将删除后的管理员信息写入文件
void FileCustomer1(Account *pnewP,Account *head);//将修改过密码的用户写入文件
Account *ReadFile2(); //读取用户信息并返回修改过密码的用户文件中链表的head
Account *FindCustomer(Account *,Account *);//判断该用户是否修改过密码
void Delete(Account *,Account *); //删除修改过密码的用户文件中链表中密码已经生效的用户
void FileCustomer3(Account *); //将修改过密码的用户文件刷新
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -