book.h

来自「图书馆是一个拥有许多图书并面向学生的一个机构」· C头文件 代码 · 共 56 行

H
56
字号
#ifndef BOOK_H
#define BOOK_H

#include<iostream.h>
class book
{
//	friend class readerhistory ;
public:
	book()
	{
		condition = true ;//图书入库时,状态初始化为真,表示图书在馆
	}

	void set()	//输入书籍资料
	{
		cout<<"请输入书籍编号:";
		cin>>code;
		cout<<"请输入书籍名称:";
		cin>>name;
	}
	void setcondition( bool a )
	{
		condition = a ;
	}
	int getcode()
	{
		return code ;
	}
	char* getname()
	{
		return name ;
	}
	bool getcondition()
	{
		return condition ;
	}
	void print()
	{
		cout<<"书籍编号:"<<code<<endl;
		cout<<"书籍名称:"<<name<<endl;
		cout<<"书籍状态:" ;
		if( condition == true)
			cout << "在馆" << endl ;
		else
			cout << "借出" << endl ;

	}
private:
	int code ;		//书籍编号
	char name[10];		//书籍名称
	bool condition ;    //图书的状态

};
#endif

⌨️ 快捷键说明

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