<p style="LINE-HEIGHT: 26px; FONT-FAMILY: Arial; COLOR: rgb(51,51,51); FONT-SIZE: 14px">/*</p><div style="LINE-HEIGHT: 26px; MARGIN: 20px; FONT-FAMILY: Arial; COLOR: rgb(51,51,51); FONT-SIZE: 14px" id="article_details" class="details"><div style="MARGIN: 20px 0px 0px" id="article_content" class="article_content"><p> *Copyright (c) 2014 ,烟台大学计算机学院</p><p> *All right reserved.</p><p> *文件名称:图书馆的书.cpp </p><p> *作 者:王伟诚</p><p> *完成日期:2015年3月18日</p><p> *版 本 号:1.0</p><p> *</p><p> *问题描述:<span style="font-family:Arial;font-size:14px;color:#333333;LINE-HEIGHT: 26px">图书馆的书</span></p><p>*问题输出:图书馆的书</p><p>*/</p></div></div>
#include <iostream>
#include <string>
using namespace std;
class Book
{
private:
string name;
string writer;
string public_name;
double price;
int number;
int NO;
public:
void setBook(string a,string b,string c,double d,int e,int f);
void borrow();
void restore();
void print();
void set_NO();
int get_NO();
};
void Book::setBook(string a,string b,string c,double d,int e,int f)
{
name=a;
writer=b;
public_name=c;
price=d;
number=e;
NO=f;
}
void Book::borrow()
{
number--;
}
void Book::restore()
{
number++;
}
void Book::print()
{
cout<<"name:"<<name<<endl<<"writer:"<<writer<<endl<<"public_name:"<<public_name<<endl<<"price:"<<price<<endl<<"number:"<<number<<endl<<"NO:"<<NO<<endl;
}
void Book::set_NO()
{ int n;
cin>>n;
NO=n;
}
int Book::get_NO()
{
return NO;
}
int main( )
{
Book aBook;
aBook.setBook("qwer", "wwc","hrf",6,8,4);
aBook.print();
aBook.borrow();
aBook.print();
aBook.restore();
aBook.print();
aBook.set_NO();
aBook.print();
cout<<"new book NO: " <<aBook.get_NO()<<endl;
return 0;
return 0;
}