Program is to define a class as library, C/C++ Programming

Program is to define a class as library:

Program is to define a class as library and perform all the function of library management by using classes and object

class library

  {

  private:

    int bkno;

    char bkname[20],auth[20],pub[20];

    float price;

    int copies;

    int issues;

  public:

    library() // constructor that is assigning initial values

     {

     copies=10;

     price=150.50;

     }

    void input();

    void issue();

    void rtbook();

    void disp();

   };

 

 void library :: input()

   {

   clrscr();

   cout<<" enter the book number "<<"\n";

   cin>>bkno;

   cout<<" enter the book name"<<"\n";

   gets(bkname);

   cout<<" enter the author name "<<"\n";

   gets(auth);

   cout<<" enter the publisher name "<<"\n";

   gets(pub);

   cout<<" enter the no. of copies you want to issue ";

   cin>>issues;

   }

  void library::issue()

    {

    if (issues>copies)

      {

      cout<<" The book is not available ";

      exit(0);

      }

    else

      cout<<" The book is available "<<"\n";

    }

 

  void library::rtbook()

    {

    clrscr();

    int bookr;

    cout<<" enter the book number ";

    cin>>bookr;

     if (bookr==bkno)

       {

       cout<<" the book has been returned ";

       }

     else

       cout<<" the book no. you have entered is wrong ";

     }

 

 void main()

  {

  library book;

  book.input();

  book.issue();

  book.rtbook();

  book.disp();

  }

 

Posted Date: 10/19/2012 5:28:03 AM | Location : United States







Related Discussions:- Program is to define a class as library, Assignment Help, Ask Question on Program is to define a class as library, Get Answer, Expert's Help, Program is to define a class as library Discussions

Write discussion on Program is to define a class as library
Your posts are moderated
Related Questions
Project Description: I'm seeking someone who could write me a torrent seeding client which supports multiple proxies. The goal of the project is to make torrents popular by seed

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

write a program that counts the number of occurences of the string in the n-th Padovan string P(n) program in java // aakash , suraj , prem sasi kumar kamaraj college progr

Explain the  bit fields portable or not? - No, Bit fields aren't portable. - As Bit fields can't span machine words and number of bits in a machine word is different on diff


How does free know the size of memory to be deleted.? int *i = (int *)malloc(12); followed by free(i); how did free function call know how much of memory to delete? A: It bas

Project Description: I am seeking a developer who can start an app from scratch and get it delivered to me as soon as possible. It is a little android based app. A background on

What are the benefits of using friend classes? - Friend classes are useful when a class wants to hide features from users which are required only by another, tightly coupled cl

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Write a c++ program to find the sum of 0.123 ? 103 and 0.456 ? 102 and write the result in three significant digits.