音响店管理系统.docx
- 文档编号:23710922
- 上传时间:2023-05-20
- 格式:DOCX
- 页数:55
- 大小:23.91KB
音响店管理系统.docx
《音响店管理系统.docx》由会员分享,可在线阅读,更多相关《音响店管理系统.docx(55页珍藏版)》请在冰豆网上搜索。
音响店管理系统
#include
#include
#include
#include
#include
#include
intloading();//登陆界面
intmainmenu();//管理主菜单
intcustmenu();//会员主菜单
intsubmenu_1();//影碟管理
intsubmenu_2();//会员管理
intsubmenu_3();//影碟出租
intsubmenu_4();//影碟返还
constcharyonghu[10]="admin";//可修改管理员名称
constcharmima[10]="123456";//可修改管理员的密码
intchoi(charnumber[10]);
charnumber1[10],name1[10];//定义全局变量姓名和编号
intyear,month,day;//可修改借碟日期限制
intx,x1,x2,year1,month1,day1,hour,minute,second,hour1,minute1,second1;
classdatatime
{
public:
settime(intyear3=0,intmonth3=0,intday3=0,inthour3=0,intminute3=0,intsecond3=0);
voidprint();
private:
inty;
intmo;
intd;
inth;
intmi;
ints;
};
datatime:
:
settime(intyear3,intmonth3,intday3,inthour3,intminute3,intsecond3)
{
y=year3;
mo=month3;
d=day3;
h=hour3;
mi=minute3;
s=second3;
}
voiddatatime:
:
print()
{
ofstreamfile;
file.open("dvdcustdata.txt",ios:
:
app);
file.write((char*)&y,sizeof(y));
file.write((char*)&mo,sizeof(mo));
file.write((char*)&d,sizeof(d));
file.write((char*)&h,sizeof(h));
file.write((char*)&mi,sizeof(mi));
file.write((char*)&s,sizeof(s));
file.close();
}
classcustomer//定义顾客类
{
public:
cust(charname[10]="",charnum[10]="");//定义顾客构造函数
intadd_member();//增加顾客
voidinquiry();//查询顾客
voidlogout();//注销顾客
voidpassword();//更改密码
voidprint();
voidrent();
voidshow();
voidmaxdvd();
voidpand(charcustnum[10]);
private:
charcustomername[10];
charcustomernum[10];
};
customer:
:
cust(charname[10],charnum[10])//定义顾客构造函数
{
if(name!
="")
{
strcpy(customername,name);
strcpy(customernum,num);
}
}
voidcustomer:
:
password()//更改密码
{
charname[10],num[10],num1[10],num2[10],num3[10],choise;
intn,i=0,j;
customerr[100];
//打开文件更改密码
ifstreamfile;
file.open("customerdata.txt",ios:
:
in);
file.clear();
file.seekg(0,ios:
:
beg);
file.read((char*)&name,sizeof(name));
file.read((char*)&num,sizeof(num));
while(file)
{
i++;
if(strcmp(number1,num)==0&&strcmp(name1,name)==0)
{
ss:
cout<<"\t请输入旧密码:
";
cin>>num1;
if(strcmp(number1,num1)==0)
{
cout<<"\t请输入新密码:
";
cin>>num2;
cout<<"\t请再次输入新密码:
";
cin>>num3;
if(strcmp(num2,num3)!
=0)
{
cout<<"\t对不起!
更改失败!
是否继续更改(Y/N)";
cin>>choise;
if(choise=='y'||choise=='Y')
gotoss;
else
n=custmenu();
}
r[i].cust(name,num2);
}
else
{
cout<<"\t密码错误是否重新输入(Y/N)";
cin>>choise;
if(choise=='y'||choise=='Y')
gotoss;
else
n=custmenu();
}
}
else
{
r[i].cust(name,num);
}
file.read((char*)&name,sizeof(name));
file.read((char*)&num,sizeof(num));
}
file.close();
//将更改后的密码写入文件中
ifstreamfile1;
file1.open("customerdata.txt",ios:
:
trunc);
file1.clear();
file1.seekg(0,ios:
:
beg);
file1.close();
for(j=1;j<=i;j++)
r[j].print();
//返回登陆界面
cout<<"\t更改成功!
回到登陆界面!
(Y/N)";
cin>>choise;
if(choise=='y'||choise=='Y')
n=loading();
}
voidcustomer:
:
maxdvd()//借碟上限
{
charnum[10],name[20],cly[10],choise;
intn=0,r;
ifstreamfile;
file.open("dvdcustdata.txt",ios:
:
in);
file.clear();
file.seekg(0,ios:
:
beg);
file.read((char*)&customernum,sizeof(customernum));
file.read((char*)&num,sizeof(num));
file.read((char*)&name,sizeof(name));
file.read((char*)&cly,sizeof(cly));
file.read((char*)&year,sizeof(year));
file.read((char*)&month,sizeof(month));
file.read((char*)&day,sizeof(day));
file.read((char*)&hour,sizeof(hour));
file.read((char*)&minute,sizeof(minute));
file.read((char*)&second,sizeof(second));
while(file)
{
if(strcmp(number1,customernum)==0)
n++;
file.read((char*)&customernum,sizeof(customernum));
file.read((char*)&num,sizeof(num));
file.read((char*)&name,sizeof(name));
file.read((char*)&cly,sizeof(cly));
file.read((char*)&year,sizeof(year));
file.read((char*)&month,sizeof(month));
file.read((char*)&day,sizeof(day));
file.read((char*)&hour,sizeof(hour));
file.read((char*)&minute,sizeof(minute));
file.read((char*)&second,sizeof(second));
}
file.close();
if(n>=5&&x2==0)
{
cout<<"\t对不起!
你借的影碟已达到上限!
"< cout<<"\t是否回到上一级菜单(Y/N)"; cin>>choise; if(choise=='y'||choise=='Y') r=custmenu(); } if(n<=0&&x2==1) { cout<<"\t对不起! 你还没有借碟不能归还! "< cout<<"\t是否回到上一级菜单(Y/N)"; cin>>choise; if(choise=='y'||choise=='Y') r=submenu_4(); } } voidcustomer: : show()//显示已借影碟 { intr; charnum[10],name[20],cly[10],choise; CTimec=CTime: : GetCurrentTime(); year1=c.GetYear(); month1=c.GetMonth(); day1=c.GetDay(); hour1=c.GetHour(); minute1=c.GetMinute(); second1=c.GetSecond(); cout< ifstreamfile; file.open("customerdata.txt",ios: : in); file.clear(); file.seekg(0,ios: : beg); file.read((char*)&customername,sizeof(customername)); file.read((char*)&customernum,sizeof(customernum)); while(file) { if(strcmp(number1,customernum)==0&&strcmp(name1,customername)==0) { cout< break; } file.read((char*)&customername,sizeof(customername)); file.read((char*)&customernum,sizeof(customernum)); } file.close(); ifstreamfile1; file1.open("dvdcustdata.txt",ios: : in); file1.clear(); file1.seekg(0,ios: : beg); file1.read((char*)&customernum,sizeof(customernum)); file1.read((char*)&num,sizeof(num)); file1.read((char*)&name,sizeof(name)); file1.read((char*)&cly,sizeof(cly)); file1.read((char*)&year,sizeof(year)); file1.read((char*)&month,sizeof(month)); file1.read((char*)&day,sizeof(day)); file1.read((char*)&hour,sizeof(hour)); file1.read((char*)&minute,sizeof(minute)); file1.read((char*)&second,sizeof(second)); while(file1) { if(strcmp(number1,customernum)==0) { cout< "< "< if(year1>year||month1>month||day1>day||hour1>hour||(minute1-minute)>1) cout< else cout< } file1.read((char*)&customernum,sizeof(customernum)); file1.read((char*)&num,sizeof(num)); file1.read((char*)&name,sizeof(name)); file1.read((char*)&cly,sizeof(cly)); file1.read((char*)&year,sizeof(year)); file1.read((char*)&month,sizeof(month)); file1.read((char*)&day,sizeof(day)); file1.read((char*)&hour,sizeof(hour)); file1.read((char*)&minute,sizeof(minute)); file1.read((char*)&second,sizeof(second)); } file1.close(); cout<<"\t是否回到上一级菜单(Y/N)"; cin>>choise; if(choise=='y'||choise=='Y') r=submenu_4(); } voidcustomer: : rent()//顾客信息写入dvdcustdata.TXT { ifstreamfile; file.open("customerdata.txt",ios: : in); file.clear(); file.seekg(0,ios: : beg); file.read((char*)&customername,sizeof(customername)); file.read((char*)&customernum,sizeof(customernum)); while(file) { if(strcmp(number1,customernum)==0) { break; } file.read((char*)&customername,sizeof(customername)); file.read((char*)&customernum,sizeof(customernum)); } file.close(); ofstreamfile1; file1.open("dvdcustdata.txt",ios: : app); file1.write((char*)&customernum,sizeof(customernum)); file1.close(); } voidcustomer: : print()//写入顾客信息 { ofstreamfile; file.open("customerdata.txt",ios: : app); file.write((char*)&customername,sizeof(customername)); file.write((char*)&customernum,sizeof(customernum)); file.close(); } voidcustomer: : logout()//顾客注销 { intn,i=0,j,f=0; charchoise,name[10],num[10],number[10]; customerr[100]; cout<<"\t请输入编号: "; cin>>number; ifstreamfile; file.open("customerdata.txt",ios: : in); file.clear(); file.seekg(0,ios: : beg); file.read((char*)&name,sizeof(name)); file.read((char*)&num,sizeof(num)); while(file) { i++; r[i].cust(name,num); if(strcmp(number,num)==0) { f=i; } file.read((char*)&name,sizeof(name)); file.read((char*)&num,sizeof(num)); } file.close(); ifstreamfile1; file1.open("customerdata.txt",ios: : trunc); file1.clear(); file1.seekg(0,ios: : beg); file1.close(); for(j=f;j<=i;j++) r[j]=r[j+1]; for(j=1;j r[j].print(); cout<<"\t注销成功! 是否回到上一级菜单(Y/N)"; cin>>choise; if(choise=='y'||choise=='Y') n=submenu_2(); } voidcustomer: : inquiry()//顾客查询 { l: intr,f=0; charchoise,number[10]; cout<<"\t请输入编号或姓名: "; cin>>number; ifstreamfile; file.open("customerdata.txt",ios: : in); file.clear(); file.seekg(0,ios: : beg); file.read((char*)&customername,sizeof(customername)); file.read((char*)&customernum,sizeof(customernum)); while(file) { if(strcmp(number,customernum)==0||strcmp(number,customername)==0) { f=1; cout<<"\t"<<"姓名"<<"\t"<<"编号"< cout<<"\t"< break; } file.read((char*)&customername,sizeof(customername)); file.read((char*)&customernum,sizeof(customernum)); } file.close(); if(f==0) { cout<<"\t顾客不存在,是否重新输入(Y/N)"; cin>>choise; if(choise=='y'||choise=='Y') gotol; } cout<<"\t是否回到上一级菜单(Y/N)"; cin>>choise; if(choise=='y'||choise=='Y') r=submenu_2(); } classdisc//定义碟片类 { public: disk(charnum[10]="",charname[20]="",charcly[10]="",intamount=0); intadd_disc(); intdisc: : add_1(charnamex[20]="",charnumx[10]=""); voiddisplay(); voidinquiry(); voidlogout(); voidprint(); voiddisc_list(); voiddisc_rent(); voiddisc_gorent(); voiddisc_return(); voiddel(charnumber[10]=""); private: chardvdnum[10]; chardiscnum[10]; chardiscname[20]; charclassify[10]; intdiscamo; }; voiddisc: : display() { ofstreamfile; file.open("dvdcustdata.txt",ios: : app); file.write((char*)&discnum,sizeof(discnum)); file.write((char*)&discname,sizeof(discname));
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 音响 管理 系统
![提示](https://static.bdocx.com/images/bang_tan.gif)