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
WAP TO PRINT ANY NAME ON SCREEN 10 TIMES void main () { int a=1; clrscr(); do { printf ("expertsmind\n"); a++; } while (a getch (); }

Program is to reverse the names stored in an array pointer: Program is to reverse the 6 names stored in an array pointer as name[] void main()   {  clrscr();  char

write a function named "fact"that takes one integer arguments,call them "num" and returns as ..............

basic salary of an employe.the allowence are House rent 20% of basic salary Medical allowence is 10% of basic salary conveyence allowence is 10% calculate anrd display gross salar

// Basic pointer code #include "stdafx.h" #include iostream using namespace std; int _tmain(int argc, _TCHAR* argv[]) {             int FirstNumber, SecondNumber;

overload assignment opertor to assign the data of one object to anthor

Sine function computation

Operation on array: void Array::add( Object& toAdd ) {     lastElementIndex++;     while( ptrAt( lastElementIndex ) != ZERO &&            lastElementIndex

Overloading Binary Operators class SI {float i,p,n,r,a; public: SI(){}; SI(int gp,int gn, int gr); void putdata(void); SI operator+(SI); }; SI SI::opera

Command-line arguments are passed into programs using the arguments of main(). Here's a quick example, for a program called by typing "progname file.txt 1 2.7": #include #incl