Search This Blog

Read Your Language

Write a C++ program to create a Book class.


Write a C++ program to create a Book class. Define proper constructor for the Book class. Define methods to do the following (a) Display price of the book.(b) Display name(s) of the Author(s) of the book.(c) Display ISBN number of the book.


#include<iostream>
using namespace std;
 class book
 {
  private:
  int price, ISBN_NO;
  char name[50];
  public:
book(char name[50],int price,int ISBN_NO )
  {
      cout<<"Display name(s) of the Author(s) of the book:"<<name<<endl;
  cout<<"Display price of the book:"<<price<<endl;
  cout<<"Display ISBN number of the book :"<<ISBN_NO<<endl;
 
       }
 
      };
main()
{   
   book name("rahul",343,786);
    
}


OUTPUT:

Display name(s) of the Author(s) of the book: rahul
Display price of the book: 343
Display ISBN number of the book : 786




No comments:

Contact Form

Name

Email *

Message *

Followers