book.cpp

来自「大一时写的一个课设」· C++ 代码 · 共 43 行

CPP
43 行
字号
//定义书籍类的函数成员
# include <iostream.h>
# include <string.h>
# include <iomanip.h>
# include "book.h"
//添加书籍
void book::addbook(int n,char *na,int m)
{
	no=n;
	strcpy(name,na);
	onshelf=m;
	tag=1;
}
//是否在架
int book::shelf()
{
	if(onshelf>0)
	{
		cout<<"该书可借"<<endl;
		return 1;
	}
	else 
	return 0;
}
//借取书籍
void book::borrowbook(int a)
{
	if(a>0)
	onshelf--;
}
//归还书籍
void book::retbook(int a)
{
	if(a>0)
	onshelf++;
}
//显示信息
void book::showinfo()
{
	cout<<"书籍号码:"<<setw(10)<<no<<endl;
	cout<<"书籍名称:"<<setw(10)<<name<<endl;
	cout<<"在库数目:"<<setw(10)<<onshelf<<endl;
}

⌨️ 快捷键说明

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