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
A: Use p = new T[n] and delete[] p:   Fred* p = new Fred[100]; ... delete[] p; Any time you allocate an array of objects through new (generally with the [n] in the n

To implement a back account system for new users

Write a program that does the following: Calculates the Velocity and Momentum of an object. The formula for the velocity is V=d/t and the formula Momentum is m=mass*velocity. Your

write a c++ program, that finds the minimum total number of shelves, including the initial one, required for this loading process.

Project Description: I have software written with VB that i helped design, but now the original author died,(Neil Tromp), and the software ended up in the hands of someone else!

What is the difference between = symbol and == symbol? - The = symbol is generally used in mathematical operations. It's used to assign a value to a given variable whereas the


The new and delete operators The C language has explained library functions- malloc() and free() for dynamic allocation and de-allocation of memory. C++ gives yet another appro

I have a Matlab assignment and I have the assignment description+ algorithm + and the output sample. the files are on a dropbox folder and you can download them from the link below

Consider a group of n robots, numbered R2D1 through R2Dn, and m tasks, numbered 1 through m. Tasks can be different and robots are specialized, hence a given robot can only perform