#include <iostream>
using namespace std;
class Book{
private:
int Book_No;
string Book_name;
string author;
string publisher;
double price;
int No_of_copies;
int No_Of_copies_issued;
public:
Book(){
Book_No=1234;
Book_name="Abcd";
author="xyz";
publisher="pq";
price=1450.00;
No_of_copies=10;
No_Of_copies_issued=5;
}
void issueBook(int id){
if (No_of_copies>=1){
cout<<"\nBook number "<<id<<" is issued ";
No_of_copies--;
}
else{
cout<<"\nNo available book.";
}
}
int getBook(int id){
Book_No=id;
return Book_No;
}
void display(){
cout<<"\nBook number: "<<Book_No;
cout<<"\nBook Name: "<<Book_name;
cout<<"\nAuthor: "<<author;
cout<<"\nPublisher: "<<publisher;
cout<<"\nPrice: "<<price;
cout<<"\nNumber of copies: "<<No_of_copies;
cout<<"\nNumber of copies issued: "<<No_Of_copies_issued;
}
};
int main()
{
Book b;
b.issueBook(1234);
b.getBook(1234);
b.display();
return 0;
}
Comments
Leave a comment