?? videotypeimp.cpp
字號:
#include <iostream>
#include <string>
#include "videoType.h"
using namespace std;
void videoType::setVideoInfo(string title, string star1,
string star2, string producer, string director,
string 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 << "Currently out of stock." << endl;
}
void videoType::checkIn()
{
copiesInStock++;
}
int videoType::getNoOfCopiesInStock() const
{
return copiesInStock;
}
void videoType::printTitle() const
{
cout << "Video Title: " << videoTitle << endl;
}
void videoType::printInfo() const
{
cout << "Video Title: " << videoTitle << endl;
cout << "Stars: " << movieStar1 << " and "
<< movieStar2 << endl;
cout << "Producer: " << movieProducer << endl;
cout << "Director: " << movieDirector << endl;
cout << "Production Company: " << movieProductionCo
<< endl;
cout << "Copies in stock: " << copiesInStock
<< endl;
}
bool videoType::checkTitle(string title)
{
return(videoTitle == title);
}
void videoType::updateInStock(int num)
{
copiesInStock += num;
}
void videoType::setCopiesInStock(int num)
{
copiesInStock = num;
}
string videoType::getTitle() const
{
return videoTitle;
}
videoType::videoType(string title, string star1,
string star2, string producer,
string director,
string productionCo, int setInStock)
{
setVideoInfo(title, star1, star2, producer, director,
productionCo, setInStock);
}
//Overload the relational operators
bool videoType::operator==(const videoType& right) const
{
return (videoTitle == right.videoTitle);
}
bool videoType::operator!=(const videoType& right) const
{
return (videoTitle != right.videoTitle);
}
bool videoType::operator<(const videoType& right) const
{
return (videoTitle < right.videoTitle);
}
bool videoType::operator<=(const videoType& right) const
{
return (videoTitle <= right.videoTitle);
}
bool videoType::operator>(const videoType& right) const
{
return (videoTitle > right.videoTitle);
}
bool videoType::operator>=(const videoType& right) const
{
return (videoTitle >= right.videoTitle);
}
ostream& operator<< (ostream& osObject, const videoType& video)
{
osObject << endl;
osObject << "Video Title: " << video.videoTitle << endl;
osObject << "Stars: " << video.movieStar1 << " and "
<< video.movieStar2 << endl;
osObject << "Producer: " << video.movieProducer << endl;
osObject << "Director: " << video.movieDirector << endl;
osObject << "Production Company: "
<< video.movieProductionCo << endl;
osObject << "Copies in stock: " << video.copiesInStock
<< endl;
osObject << "_____________________________________"
<< endl;
return osObject;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -