class fnublic lib
{
int z;
public:
void add_(void);
void delete_(void);
void plus(void);
void display_(void);
void initial(){z=0;}
void srch();
};
void fn :: add_(void) //To add a new book
{
int m,n,k;
clrscr();
fstream f1;
f1.open("book1.txt",ios:ut|ios::app);
cout<<"\n\nEnter the book name :";
cin>>name[z];
cout<<"Enter writter name :";
cin>>wn[z];
cout<<"Enter the book code :";
cin>>code[z];
cout<<"Enter the no. of copy :";
cin>>copy[z];
if (n>0)
{
n--;
f2<<n;
cout<<"\nOne copy of this book is deleted from list.";
getch();
break;
}
else
{
cout<<"Not available copy.";
break;
}
}
}
f2.close();
}
void fn :: plus(void) //To add a copy of book to list
{
int j;
cout<<"\n\n";
cout<<"\t*************** BOOK LIST ***************";
cout<<"\n\n";
cout<<"Bookname"<<setw(25)<<"Writter"<<setw(18)<<"Code"<<setw(17)<<"Copy"<<endl;
cout<<"--------"<<setw(25)<<"-------"<<setw(18)<<"----"<<setw(17)<<"----"<<endl;
if(n==j)
{
cout<<" Book name : "<<c<<endl;
cout<<" Writter name : "<<d<<endl;
cout<<" Book code : "<<n<<endl;
cout<<" Available copy : "<<p<<endl<<endl;
getch();
k++;
}
if(k==1)
break;
}
}
int main () //Main function
{
int i;
fn f;
f.initial();
clrscr();
while(1)
{
clrscr();
cout<<"\n\n***----- WELL COME TO LIBRARY MANAGEMENT PROGRAM -----***";
cout<<"\n\nWhat do you want to do?"<<endl;
cout<<"\n1: Add a new book to the list.";
cout<<"\n2: Delete a copy of book from list.";
cout<<"\n3: Add a copy of book to list.";
cout<<"\n4: See the book list.";
cout<<"\n5: Search a Book from list.";
cout<<"\n6: Exit ."<<endl;
cout<<"\nInput your choice:";
cin>>i;