#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
class lib
{
static int d_it,d_cse,bk,tot;
public:
static void it_staff ( int a)
{
int t_it;
cout<<"\n\t Enter the no.of books required:";
cin>>bk;
t_it=a;
if(bk<t_it)
{
d_it=d_it+bk;
tot=tot-bk;
cout<<"\n\t\t Books obtained by IT dept"<<" "<<d_it;
cout<<"\n\t\t Total Books in library"<<" "<<tot;
}
else
{
cout<<"\n\t\t Level exceeded for IT";
}
}
static void cse_staff(int a)
{
int t_cse;
cout<<"\n\t Enter the no.of books required:";
cin>>bk;
t_cse=a;
if(bk<t_cse)
{
d_cse=d_cse+bk;
tot=tot-bk;
cout<<"\n\t\t Books obtained by CSE dept"<<" "<<d_cse;
cout<<"\n\t\t Total Books in library"<<" "<<tot;
}
else
{
cout<<"\n\t\t Level exceeded for CSE";
}
}
static void cse_stud()
{
cout<<"\n\t Enter the no.of books required:";
cin>>bk;
if(bk>0)
{
tot=tot-bk;
cout<<"\n\t\t Books obtained by CSE students"<<" "<<bk;
cout<<"\n\t\t Total Books in library"<<" "<<tot;
}
}
static void it_stud()
{
cout<<"\n\t Enter the no.of books required:";
cin>>bk;
if(bk>0)
{
tot=tot-bk;
cout<<"\n\t\t Books obtained by IT students"<<" "<<bk;
cout<<"\n\t\t Total Books in library"<<" "<<tot;
}
}
};
int lib::tot=1000;
int lib::d_it=0;
int lib::d_cse=0;
int lib::bk;
void main()
{
int ch;
clrscr();
lib l;
cout<<"\t\t\t LIBRARY MANAGEMENT\n\n";
cout<<"1.IT DEPT STAFF\n2.CSE DEPT STAFF\n3.IT DEPT STUDENTS\n4.CSE DEPTSTUDENTS\n5.EXIT";
do
{
cout<<"\n Enter the choice displayed above:";
cin>>ch;
switch(ch)
{
case 1:
int t_it=300;
l.it_staff(t_it);break;
case 2:
int t_cse=200;
l.cse_staff(t_cse);break;
case 3:
l.it_stud();break;
case 4:
l.cse_stud();break;
case 5:
exit(0);
}
}while(ch<=4);
getch();
}
Comments
Post a Comment