📄 videotype.cpp
字号:
#include "videoType.h"
#include <iostream.h>
void videoType::setVideoInfo(newString title,newString star1,newString star2,newString producer,
newString director,newString productionCo,int setInStock)
{
videoTitle = title;
movieStar1 = star1;
movieStar2 = star2;
movieProducer = producer;
movieDirector = director;
movieProductionCo = productionCo;
copiesInStock = setInStock;
}
void videoType::checkOut()
{
if(getNoOfCopiesInStock() > 0)
copiesInStock--;
else
cout<<"此碟目前已经租完"<<endl;
}
void videoType::checkIn()
{
copiesInStock++;
}
int videoType::getNoOfCopiesInStock() const
{
return copiesInStock;
}
void videoType::printTitle() const
{
cout<<"影碟名:"<<videoTitle<<endl;
}
void videoType::printInfo() const
{
cout<<"影碟名:"<<videoTitle<<endl;
cout<<"主演:"<<movieStar1<<" and "<<movieStar2<<endl;
cout<<"制片人:"<<movieProducer<<endl;
cout<<"导演:"<<movieDirector<<endl;
cout<<"库存数:"<<copiesInStock<<endl;
}
bool videoType::checkTitle(newString title)
{
return(videoTitle == title);
}
void videoType::updateInStock(int num)
{
copiesInStock +=num;
}
void videoType::setCopiesInStock(int num)
{
copiesInStock = num;
}
newString videoType::getTitle()
{
return videoTitle;
}
videoType::videoType(newString title,newString star1,newString star2,newString producer,
newString director,newString productionCo,int setInStock)
{
videoTitle = title;
movieStar1 = star1;
movieStar2 = star2;
movieProducer = producer;
movieDirector = director;
movieProductionCo = productionCo;
copiesInStock = setInStock;
}
bool videoType::operator ==(videoType other)
{
return (videoTitle == other.videoTitle);
}
bool videoType::operator !=(videoType other)
{
return (videoTitle != other.videoTitle);
}
ostream& operator<<(ostream& osObject,const videoType& video)
{
osObject<<endl;
osObject<<"碟名:"<<video.videoTitle<<endl;
osObject<<"主演:"<<video.movieStar1<<" and "<<video.movieStar2<<endl;
osObject<<"制片人:"<<video.movieProducer<<endl;
osObject<<"导演:"<<video.movieDirector<<endl;
osObject<<"制片公司:"<<video.movieProductionCo<<endl;
osObject<<"库存量:"<<video.copiesInStock<<endl;
osObject<<"_____________________________________________"<<endl;
return osObject;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -