/*
*Copyright (c)2015,烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:score.cpp
*作 者:战九州
*完成日期:2015年3月21日
*版 本 号:v1.0
*
#include <iostream>
using namespace std;
class Book
{
public:
void set_book();
void set_borrow( );
void set_restor( );
void set_print( );
void set_NO(int );
void get_NO(int );
private:
string name;
string writer;
string public_name;
double pric;
int number;
int NO;
};
void Book::set_book( )
{
string n,w,p;
double pr;
int N,num;
cout<<"书名:";
cin>>n;
name=n;
cout<<"作者:";
cin>>w;
writer=w;
cout<<"出版社:";
cin>>p;
public_name=p;
cout<<"价格:";
cin>>pr;
pric=pr;
cout<<"数量:";
cin>>num;
number=num;
cout<<"书号:";
cin>>N;
NO=N;
}
void Book:: set_borrow( )
{
cout<<"借"<<endl;
number--;
}
void Book:: set_restor( )
{
cout<<"还"<<endl;
number++;
}
void Book:: set_print( )
{
cout<<"name: "<<name<<endl;
cout<<"writer: "<<writer<<endl;
cout<<"public_name: "<<public_name<<endl;
cout<<"pric: "<<pric<<endl;
cout<<"number: "<<number<<endl;
cout<<"NO: "<<NO<<endl;
}
void Book:: set_NO(int N )
{
NO=N;
}
void Book:: get_NO(int )
{
cout<<NO<<endl;
}
int main()
{
int N;
Book book;
book.set_book();
book.set_print( );
book.set_borrow( );
book.set_print( );
book.set_restor( );
book.set_print( );
cin>>N;
book.set_NO( N );
book.set_print();
}
<img src="https://img-blog.csdn.net/20150322151038365?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmppdXpob3U=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />