Current location - Training Enrollment Network - Books and materials - Mybook family book management system
Mybook family book management system
# include & ltiostream & gt

Use namespace std

Classroom books

{

Public:

Book(char * pName,double price,int number)

{

strcpy(pBookName,pName);

M_Price = price;

M_Number = number;

}

Empty display ()

{

Cout & lt& lt "name:"<& ltpBookName & lt& ltendl.

Cout & lt& lt "price:"<& ltm _ Price & lt& lt RMB "<& ltendl.

cout & lt& lt" numer:" & lt; & ltm _ Number & lt& ltendl

}

Invalid borrowing ()

{

if(m _ Number & gt; 0)

{

m _ Number-= 1;

Cout & lt& lt was successfully lent out, and the current book inventory is

Return;

}

other

{

Cout & lt& lt "At present, the storage capacity of this book is 0, so it cannot be checked out" < & ltendl.

Return;

}

}

Invalid recovery ()

{

m _ Number+= 1;

Cout & lt& lt The book has been returned successfully, and the current inventory is.

Return; }

Private:

char pBookName[20];

Double m _ Price

Unsigned integer m _ Number

};

int main()

{

Book my book1(Introduction to C++,78, 25);

mybook 1 . display();

mybook 1 . borrow();

mybook 1 . restore();

System ("suspended");

Returns 0;

}