📄 custtype.cpp
字号:
#include <iostream.h>
#include "custType.h"
void custType::setCustInfo(newString acctno,newString fname,newString lname,
newString v1,newString v2,newString v3)
{
custAcctNo=acctno;
firstName=fname;
lastName=lname;
video1=v1;
video2=v2;
video3=v3;
}
void custType::printcustInfo()
{
cout<<"帐号:"<<custAcctNo<<endl;
cout<<"姓名:"<<firstName<<" "<<lastName<<endl;
cout<<"影碟: 1<"<<video1<<">; 2<"<<video2<<">; 3<"<<video3<<">"<<endl<<endl;
}
void custType::rentVideo(newString title)
{
if(video1==" ")
video1=title;
else
{
if(video2==" ")
video2=title;
else
{
if(video3==" ")
video3=title;
else
cout<<"你已经借满,不能再租碟!"<<endl;
}
}
}
void custType::backVideo(newString title)
{
if(video1==title)
video1=" ";
else
{
if(video2==title)
video2=" ";
else
{
if(video3==title)
video3=" ";
else
cout<<"对不起,该顾客并没有租此碟!"<<endl;
}
}
}
bool custType::checkcustAcctNo(newString id)
{
return (custAcctNo==id);
}
custType::custType()
{
firstName= " ";
lastName= " ";
custAcctNo= " ";
video1= " ";
video2= " ";
video3= " ";
}
ostream& operator<<(ostream& osObject,const custType& customer)
{
osObject<<endl;
osObject<<"帐号:"<<customer.custAcctNo<<endl;
osObject<<"姓名:"<<customer.lastName<<" "<<customer.firstName<<endl;
osObject<<"所租影碟:1<"<<customer.video1 <<">;2<"<<customer.video2<<">;3<"<<customer.video3<<">"<<endl;
osObject<<"_____________________________________________"<<endl;
return osObject;
}
bool custType::CustVideo(newString title)
{
if(video1 == title)
return true;
else
{
if(video2 == title)
return true;
else
{
if(video3 == title)
return true;
else
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -