Saturday, 17 March 2012

Library Management System in C++


#include<iostream.h>
#include<conio.h>
int a=2,b=3,c=4,i=0;
class lib
{
int n;
public:

void issue();
void show();
void ret();
};

 void lib::issue()
{                                                               
cout<<"enter code:";
cin>>n;


switch(n)
{
case 101:
if(a!=i)
{
a--;
cout<<"morish mano is issued\nno. of books="<<a<<"\n\n";

}
break;
case 102:
if(b!=i)
{
b--;
cout<<"peter syckes is issued\n no. of book="<<b<<"\n\n";

}
break;
case 103:
if(c!=i)
{
c--;
cout<<"ncert maths is issued\n no. of book="<<c<<"\n\n";

}
break;
}
}
void lib::ret()
{
cout<<"enter code to return the book:";
cin>>n;


switch(n)
{
case 101:
if(a!=2)
{
a++;
cout<<"morish mano is returned\nno. of books="<<a;

}
break;
case 102:
if(b!=3)
{
b++;
cout<<"peter syckes is returned\n no. of book="<<b;

}
break;
case 103:
if(c!=4)
{
c++;
cout<<"ncert maths is returned\n no. of book="<<c;

}
break;
}
}

void lib::show()
{
cout<<"book code:101\n";
cout<<"name: morish mano\n";
cout<<"availability:"<<a<<"\n\n";
cout<<"book code:102\n";
cout<<"name: peter sykes\n";
cout<<"availability:"<<b<<"\n\n";
cout<<"book code:103\n";
cout<<"name: ncert maths\n";
cout<<"availability:"<<c<<"\n\n";
}
void main()
{
class lib lb;
int k,m;
clrscr();
x:
cout<<"enter 1 to see the list of books\n";
cout<<"enter 2 to issue the book\n";
cout<<"enter 3 to return the book\n";
cout<<"number:";
cin>>k;
switch(k)
{
case 1:
lb.show();
cout<<"\nenter 0 to go to previous:";
cin>>m;
if(m==0)
goto x;
else
break;
case 2:
lb.issue();
cout<<"\nenter 0 to go to previous:";
cin>>m;
if(m==0)
goto x;
else
break;
case 3:
lb.ret();
cout<<"\nenter 0 to go to previous:";
cin>>m;
if(m==0)
goto x;
else
break;
}
getch();
}

2 comments:

  1. .The Online Library Management System is designed & developed for a receipt and issuance of books in the library along with the student’s details.

    Library Information Management Software

    ReplyDelete
  2. respected sir,
    this programm is not running at my laptop. there are some error....

    ReplyDelete