#include<iostream> //文件包含类型
#include<fstream>
#include"wangchuandefine.h"
#include<string>
using namespace std ;
void Run(void) ;
void Instruction(void);
int main(void)
{
int choice;
while(1)
{
cout<<"请输入选择!,0表示阅读使用说明,1表示运行程序!"<<endl ;
cin>>choice;
switch(choice)
{
case 0: Instruction();
break ;
case 1: Run();
break ;
}
}
return 0;
}
void Run(void)
{
int choice;
string title,account,video ;
CustomerTypeList Chead ; //头结点
VideoTypeList Vhead;
VideoList Vlist ;
CustomerList Clist ; //定义对象
Vhead=Vlist.createVideoTypeList();
Chead=Clist. createCustomerTypeList();
do
{
cout<<"---------音像店影碟管理系统 -------------"<<endl;
cout<<endl ;
cout<<"--------------主菜单--------------------"<<endl ;
cout<<endl ;
cout<<" 1: 输出音像店所有库存影碟信息 "<<endl;
cout<<" 2: 借出影碟 "<<endl;
cout<<" 3: 归还影碟 "<<endl;
cout<<" 4: 增加新顾客 "<<endl;
cout<<" 5: 增加新影碟 "<<endl;
cout<<" 6: 按名称查找影碟 "<<endl;
cout<<" 7: 按名称查找顾客 "<<endl;
cout<<" 8: 输出租赁影碟顾客的信息 "<<endl;
cout<<" 9: 删除某顾客 "<<endl;
cout<<" 10: 删除某影碟 "<<endl;
cout<<" 11: 修改某影碟的属性 "<<endl;
cout<<" 12: 修改某顾客的属性 "<<endl;
cout<<" 0: 推出系统 "<<endl;
cout<<endl ;
cout<<"请输入您要选择的操作!"<<endl ;
cin>>choice;
if(choice<0 ||choice>12)
{
cout<<"对不起,您输入的选择有误!正确的范围是[0,12]"<<endl;
break ;
}
cout<<endl ;
switch(choice)
{
case 1: cout<<"显示影像店所有影碟信息"<<endl;
Vlist.VideoListDisplay(Vhead);
break ;
case 2: cout<< "输入影碟名称:"<<endl;
cin>>title;
cout << endl;
if(Vlist.VideoSearch(title,Vhead))
{
if(Vlist.ifVideoAvailable(title,Vhead))
{
cout<<"请输入顾客的帐号!"<<endl ;
cin>>account ;
if(Clist.videoCheckOut(account,title,Chead)==1 )
{
cout << "借出影碟:片名为:" <<title << endl;
Vlist.VideoCheckOut(title,Vhead);
}
else if(Clist.videoCheckOut(account,title,Chead)==2)
cout<<"对不起,您所借影碟数目已达最大,不能再借了!!"<<endl ;
else if(Clist.videoCheckOut(account,title,Chead)==0)
{
cout<<"目前暂未有该顾客任何记录,需要新增该顾客!"<<endl ;
Clist.CustomerAdd(Chead,account,title);
Vlist.VideoCheckOut(title,Vhead);
}
}
else
{
cout<< "很抱歉,该影碟库存不足!" << endl;
}
}
else
cout<< "很抱歉,库中没有该影碟!" << endl;
break ;
case 3: cout << "输入影碟名称:";
cin>>title;
cout << endl;
if(Vlist.VideoSearch(title,Vhead))
{
cout<<"请输入顾客的帐号!"<<endl ;
cin>>account ;
if( Clist.CustomerSearch(account,Chead) )
{
if(Clist.VideoCheckIn(title,account,Chead)==1)
{
cout << "感谢归还影碟:" << title << endl;
Vlist.VideoCheckIn(title,Vhead);
break ;
}
else if(Clist.VideoCheckIn(title,account,Chead)==2)
{
cout<<endl ;
cout<<"对不起,您的个人信息库中没有该影碟,不能完成还书操作!"<<endl ;
break ;
}
}
else
{
cout<<"对不起,您输入的帐号有误,不能完成还书操作!"<<endl ;
break ;
}
}
else
cout << "抱歉,库中没有该影碟!" << endl;
break;
case 4: cout<<"增加新顾客"<<endl;
cout<<"请输入顾客的帐号"<<endl ;
cin>>account ;
cout<<"请输入该顾客已借影碟名称"<<endl ;
cin>>video;
if( !Clist.CustomerAdd(Chead,account,video ))
{
cout<<"对不起,您输入的帐号已经存在!!"<<endl ;
break;
}
else
{
cout<<"成功增加顾客!"<<endl ;
break ;
}
case 5: cout<<"增加新影碟"<<endl;
Vlist.VideoAdd(Vhead) ;
break ;
case 6: cout << "请输入影碟名称:";
cin>>title;
cout<<endl;
if(Vlist.VideoSearch(title,Vhead))
{
cout << "找到该影碟。" <<endl;
break ;
}
else
{
cout << "该影碟不在库中。" <<endl;
break ;
}
case 7: cout << "请输入顾客帐号:";
cin>>account;
cout<<endl;
if(Clist.CustomerSearch(account,Chead))
{
break ;
}
else
{
cout << "该顾客不在库中。" << endl;
break ;
}
case 11: cout<<"修改某张影碟的属性"<<endl ;
cout<<"请输入要修改的影碟的片名!"<<endl ;
cin>>title ;
if( Vlist.Videochange( title , Vhead )==1)
{
cout<<"修改成功!"<<endl ;
break ;
}
else if(Vlist.Videochange( title , Vhead )==0)
{
cout<<"对不起,没找到您要修改的影碟,请检查您的输入!"<<endl ;
break ;
}
else if(Vlist.Videochange( title , Vhead )==2)
break ;
case 12: cout<<"修改某顾客的属性"<<endl ;
cout<<"请输入要修改的顾客的帐号!"<<endl ;
cin>>account ;
if( Clist.Customerchange( account , Chead)==1)
{
cout<<"修改成功!"<<endl ;
break ;
}
else if(Clist.Customerchange( account , Chead)==0)
{
cout<<"对不起,没找到您要修改的顾客,请检查您的输入!"<<endl ;
break ;
}
else if(Clist.Customerchange( account , Chead)==2)
{}
break ;
case 8: cout<<" 查找租赁影碟的顾客信息 "<<endl;
Clist.CustomerListDisplay(Chead);
break ;
case 10 : cout<<"删除某影碟"<<endl ;
cout<<"请输入该影碟片名!"<<endl ;
cin>>title ;
if(Vlist.VideoSearch(title,Vhead))
{
Vlist.VideoDelete(Vhead,title);
cout<<"成功删除该影碟!"<<endl ;
}
else
{}
break ;
case 9 : cout<<"删除某顾客"<<endl ;
cout<<"请输入该顾客的帐号!"<<endl ;
cin>>account ;
if(Clist.CustomerSearch(account,Chead))
{
Clist.CustomerDelete(Chead,account);
cout<<"成功删除该顾客!"<<endl ;
}
break ;
case 0: cout<<"欢迎再次使用本程序!!"<<endl ;
exit(0);
}
}while(1) ;
}
void Instruction(void)
{
cout<<"本程序共有12个功能分别为:"<<endl ;
cout<<"1: 输出音像店所有库存影碟信息"<<endl ;
cout<<"2: 顾客可以借出影碟"<<endl ;
cout<<"3: 顾客影碟信息"<<endl ;
cout<<"4: 增加新顾客 "<<endl ;
cout<<"5: 增加新影碟 "<<endl ;
cout<<"6: 按名称查找影碟 "<<endl ;
cout<<"7: 按名称查找顾客 "<<endl ;
cout<<"8: 顾客可以借出影碟"<<endl ;
cout<<"9: 顾客影碟信息"<<endl ;
cout<<"10: 增加新顾客 "<<endl ;
cout<<"11: 增加新影碟 "<<endl ;
cout<<"12: 按名称查找影碟 "<<endl ;
cout<<"当顾客归还影碟时,请工作人员仔细的核对信息后在进行相应的操作,以防出错"<<endl;
cout<<endl ;
}
开发的音像店影碟管理系统
需积分: 9 18 浏览量
2010-07-16
10:46:52
上传
评论 3
收藏 6KB RAR 举报
大串串
- 粉丝: 0
- 资源: 2