/*
Class Book Pointer to object
*/
#include<iostream>
using namespace std;
class Book
{
char book_name[20],author_name[20];
int price;
public:
void accept()
{
cout<<"\n\n Enter Book Name, Author Name and Price: ";
cin>>book_name>>author_name>>price;
}
void display()
{
cout<<"\n\n Book Name: "<<book_name;
cout<<"\n Author Name: "<<author_name;
cout<<"\n Price: "<<price;
}
};
int main()
{
Book B,*BP;
BP=&B;
BP->accept();
BP->display();
return 0;
}
Class Book Pointer to object
*/
#include<iostream>
using namespace std;
class Book
{
char book_name[20],author_name[20];
int price;
public:
void accept()
{
cout<<"\n\n Enter Book Name, Author Name and Price: ";
cin>>book_name>>author_name>>price;
}
void display()
{
cout<<"\n\n Book Name: "<<book_name;
cout<<"\n Author Name: "<<author_name;
cout<<"\n Price: "<<price;
}
};
int main()
{
Book B,*BP;
BP=&B;
BP->accept();
BP->display();
return 0;
}