⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 videotype.h

📁 C++编成数据结构与程序设计方法 D.S.Malk编著
💻 H
字号:
#ifndef H_videoType
#define H_videoType
#include <iostream>
#include <string>

using namespace std;

class videoType
{
    friend ostream& operator<< (ostream&, const videoType&);

public:
    void setVideoInfo(string title, string star1, 
                      string star2, string producer, 
                      string director, string productionCo, 
                      int setInStock);
      //Function to set the details of a video. 
      //The member variables are set according to the 
      //parameters.
      //Postcondition: videoTitle = title; movieStar1 = star1;
      //               movieStar2 = star2; 
      //               movieProducer = producer;
      //               movieDirector = director; 
      //               movieProductionCo = productionCo; 
      //               copiesInStock = setInStock;

    int getNoOfCopiesInStock() const;
      //Function to check the number of copies in stock. 
      //Postcondition: The value of copiesInStock is returned.

    void checkOut();
      //Function to rent a video. 
      //The number of copies in stock is decremented by one.
      //Postcondition: copiesInStock--;

    void checkIn();
      //Function to check in a video.
      //The number of copies in stock is incremented by one.
      //Postcondition: copiesInStock++;

    void printTitle() const;
      //Function to print the title of a movie.

    void printInfo() const;
      //Function to print the details of a video.
      //Postcondition: The title of the movie, stars, director,
      //               and so on are output on the screen.

    bool checkTitle(string title);
      //Function to check whether the title is the same as the
      //title of the video.
      //Postcondition: Returns the value true if the title is
      //               the same as the title of the video, and
      //               false otherwise.

    void updateInStock(int num);
      //Function to increment the number of copies in stock by
      //adding the value of the parameter num.
      //Postcondition: copiesInStock = copiesInStock + num;

    void setCopiesInStock(int num);
      //Function to set the number of copies in stock.
      //Postcondition: copiesInStock = num;

    string getTitle() const;
      //Function to return the title of the video.
      //Postcondition: The title of the video is returned.

    videoType(string title = "", string star1 = "", 
              string star2 = "", string producer = "", 
              string director = "", string productionCo = "",
              int setInStock = 0);
      //Constructor
      //The member variables are set according to the incoming
      //parameters. If no values are specified, the default
      //values are assigned.
      //Postcondition: videoTitle = title; movieStar1 = star1;
      //               movieStar2 = star2; 
      //               movieProducer = producer;
      //               movieDirector = director;
      //               movieProductionCo = productionCo;
      //               copiesInStock = setInStock;

        //Overload relational operators
    bool operator==(const videoType&) const;
    bool operator!=(const videoType&) const;
    bool operator<(const videoType&) const;
    bool operator<=(const videoType&) const;
    bool operator>(const videoType&) const;
    bool operator>=(const videoType&) const;

private:
    string videoTitle;  //variable to store the name 
                        //of the movie
    string movieStar1;  //variable to store the name 
                        //of the star
    string movieStar2;  //variable to store the name 
                        //of the star 
    string movieProducer; //variable to store the name 
                          //of the producer 
    string movieDirector; //variable to store the name 
                          //of the director 
    string movieProductionCo; //variable to store the name
                              //of the production company 
    int copiesInStock;  //variable to store the number of 
                        //copies in stock
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -