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

📄 d_book.h

📁 本软件利用VC++树结构
💻 H
字号:
#ifndef VIDEO_CLASS
#define VIDEO_CLASS
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

class book
{
	public:
		book(const string& aauthor= "",const string& aname= "", 
			const string& aISBN= "",const string& apudate= "",int copies = 1):
			name(aname), ISBN(aISBN),author(aauthor),
			pudate(apudate),numCopies(copies){}
	
	   void updateCopies(int n)
		{
			numCopies += n;
		}

		int getCopies()
		{
			return numCopies;
		}
		void setCopies(int a)
		{
			numCopies+=a;
		}

		string&  getAuthor()
		{
			return author;
		}
		string& getName()
		{
			return name;
		}
		string& getISBN()
		{
			return ISBN;
		}
		string& getPudate()
		{
			return pudate;
		}
		friend bool operator== (const book& lhs, const book& rhs)
		{
			return lhs.author == rhs.author;
		}

		// compare video objects by comparing film titles
		friend bool operator< (const book& lhs, const book& rhs)
		{
			return lhs.author < rhs.author;
		}

		// output a video object
		friend ostream& operator<< (ostream& ostr, const book& obj)
		{   
			ostr <<left<<setw(15)<<obj.ISBN
				<<left<<setw(15)<<obj.name
				<<left<<setw(15)<<obj.author
				<<left<<setw(15)<<obj.pudate
				<<left<<setw(15)<<obj.numCopies;		
			return ostr;
		}
	private:
		string author;
		string name;
		string ISBN;
        string pudate;
		int numCopies;
};

#endif	// VIDEO_CLASS

⌨️ 快捷键说明

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