Вы находитесь на странице: 1из 14

CERTIFICATE

This is to certify that the project


work “LIBRARY MANAGEMENT
SYSTEM” is a bonafide record of work done
by Mr. YOUR NAME under my guidance and
supervision.
MR. TEACHER'S NAME
SCHOOL NAME

ACKNOWLEDGMENT
I am extremely grateful to Mr. TEACHER'S
NAME , Teacher of Department of Computer
Science for his able guidance and useful
suggestions, which helped me in completing
the project work, in time.
I would also like to thank all the teaching and
non-teaching staff of Computer Science
department who helped me directly or
indirectly in the completion of this project .
Finally, yet importantly, I would like to
express my heartfelt thanks to my beloved
parents for their blessings, my friends/
classmates for their help and wishes for the
successful completion of this project.
YOUR NAME

TABLE OF CONTENTS
INTRODUCTION……………………………………………….
…………………………….....5
HEADER FILES USED AND THEIR
PURPOSE……………………………………………….6
SOURCE CODE…………………………………………………..
…………………….. ………7
OUTPUT SCREEN……………………………………….. ……
……………………...………13
LIMITATION AND SUGGESTION…………………………
…………………….. …………17
BIBLIOGRAPHY……………………………………………….
…………………….. ……….17
INTRODUCTION
The project is designed for public library in
C++. The title of the project is Library
management system. In this project a
member can issue one book from library. He
has to submit it before 2 days. Otherwise fine
will be charged @ Re. 100/- for each day.
Administrator of the project can enter new
member record, display all/specific member
record, he can add and delete member
record. Administrator can enter new book
record, display all books , add and delete
book.

HEADER FILES USED


AND THEIR PURPOSE
1.  FSTREAM.H – for file handling, cin
and cout               
2.  PROCESS.H – for exit() function
3.  CONIO.H – for clrscr() and getch()
functions
4.  STDIO.H – for standard I/O operations
5.  STRING.H – for string handling  
6.  CTYPE.H – for character handling

DATA FLOW DIAGRAM

Source Code
#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<fstream.h>
#include<stdio.h>
#include<ctype.h>

class books
{ char name[50],author[50];
int bookcode,i;

public : int copies;


void getval ()
{ clrscr();
cout<<"Enter Books Name"<<endl;
gets(name);
cout<<"\nEnter Author"<<endl;
gets(author);
bookcode=code();
}
char bookname()
{ return (name[50]);
}
int code()
{ books b1;
int c=0;
int o;
fstream a;
a.open("Library.dat",ios::in,ios::binary);
a.read((char*)&b1,sizeof(books));
while (a)
{ c++;
a.read((char*)&b1,sizeof(books));
if(!a)
{ break;
}
}
a.close();
return(c+1);
}
void showval()
{ cout<<name<<"\t\t"<<author<<"\t\t"<<bookcode;
}

};
class member
{ char member[50];
public :
int membership;char bookname;
void insert()
{ clrscr();
cout<<"\t\t New Members"<<endl;
cout<<"\t\t =*=*=*=*=*="<<endl;
cout<<"Enter Members Name"<<endl;
gets(member);
membership=re();
}
void show()

{ cout<<member<<"\t\t"<<membership<<"\t\t"<<bookname;
}
int re()
{
int c=0;
int o;
fstream a;
a.open("Member.dat",ios::in,ios::binary);
a.read((char*)&member,sizeof(member));
while (a)
{ c++;
a.read((char*)&member,sizeof(member));
if(!a)
{ break;
}
}
a.close();
return(c+1);
}
};
void newb()
{ fstream afile; char na; books b1; int b;
afile.open("Library.dat",ios::app,ios::binary);
cout<<"Do You want to add a new book or add a
copy of existing book \n 1.New Book 2.Existing
Book"<<endl;
cin>>b;
switch (b)
{ case 2:
clrscr();
cout<<"Enter the name of book"<<endl;
cin>>na;
while (afile)
{
afile.read((char*)&b1,sizeof(books));
if (na == b1.bookname() )
{ b1.copies++;
}
}
cout<<"Book added";
break;
case 1:
b1.getval();
afile.write((char*)&b1,sizeof(books));
break;
default :
cout<<"Wrong Choice";
break;
} getch();
}
void deleteb()
{ books b1;
char found='f';
int bid ;
fstream a;
fstream b;
cout<<"Enter the Books Name to be
Deleted"<<endl;
cin>>bid;
a.open("Library.dat",ios::in,ios::binary);
b.open("i.dat",ios::in,ios::binary);
while (a)
{ a.read((char*)&b1,sizeof(books));
if (bid == b1.bookname())
{ cout<<"Record has been deleted";
}
else
{ b.write((char*)&b1,sizeof(books));
}
}
a.close();
b.close();
remove("Library.dat");
rename("i.dat","Library.dat");
}
void inventory()
{ clrscr(); int a;
cout<<"\t\t INVENTORY"<<endl;
cout<<"\t\t +-+-+-+-+"<<endl;
cout<<" 1. New Book \n2.Delete
Record"<<endl<<"Enter your choice ";
cin>>a;
if (a==1)
{ newb();
}
else if (a==2)
{ deleteb();
}
}
void avail()
{ clrscr(); books b1; char name;
cout<<"\t\t\tAvailability"<<endl;
cout<<"\t\t\t=-=-=-=-=-=-"<<endl;
cout<<"Enter The Book Name to be searched for
"<<endl;
cin>>name;
fstream a;
a.open("Library.dat",ios::in,ios::binary);
while (a)
{ a.read((char*)&b1,sizeof(books));
if(name==b1.bookname())
{cout<<"\nThe No of Copies Availiable
"<<b1.copies;
}
} }
void newmember()
{ member m1;
m1.insert ();
fstream a;
a.open("Member.dat",ios::app,ios::binary);
a.write((char*)&m1,sizeof(member));
}
void issue()
{ char name ; books b1;
member m1;
int no;
fstream a,b;
clrscr();
cout<<"\t\t ISSUING"<<endl;
cout<<"\t\t =*=*=*="<<endl;
cout<<"Enter the book to be Issued"<<endl;
cin>>name;
cout<<"\n Enter The Membership No"<<endl;
cin>>no;
a.open("Library.dat",ios::out,ios::binary);
b.open("Member.dat",ios::out,ios::binary);
while (a)
{ a.read((char*)&b1,sizeof(books));
if (name==b1.bookname())
{ b1.copies=b1.copies-1;
}
}
while (b)
{ b.read((char*)&m1,sizeof(member));
if (no==m1.membership)
{ m1.bookname==name; }
}
cout<<"Book Issued";
getch();
}
void returns()
{ char name ; books b1;
member m1;
int no;
fstream a,b;
clrscr();
cout<<"Enter the book to be Returned"<<endl;
cin>>name;
cout<<"\n Enter The Membership No"<<endl;
cin>>no;
a.open("Library.dat",ios::out,ios::binary);
b.open("Member.dat",ios::out,ios::binary);
while (a)
{ a.read((char*)&b1,sizeof(books));
if (name==b1.bookname())
{ b1.copies=b1.copies+1;
}
}
while (b)
{ b.read((char*)&m1,sizeof(member));
if (no==m1.membership)
{ m1.bookname=='\o'; }
}
cout<<"Book Issued";
getch();
}
void book()
{ fstream a;
books b1;
a.open("Library.dat",ios::in,ios::binary);
while (a)
{ a.read((char*)&b1,sizeof(books));
b1.showval();
cout<<"\n";
}
getch();
}
void members()
{ fstream a; member m1;
a.open("Member.dat",ios::in,ios::binary);
while (a)
{ a.read((char*)&m1,sizeof(member));
m1.show();
}
getch();
}
void main ()
{textbackground(2);
textcolor(0);

clrscr();int j,N,choice ;
j=1; int xc=3;
while (j==1)
{
for(int zx=1;zx<=3;zx++)
{ xc=xc-1;
cout<<"\t\t\t Welcome to P&P Public Library"<<endl;

cout<<"\t\t\t=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*="<<endl<<e
ndl<<endl;
cout<<"\t\t\t TEACHERS LOGIN"<<endl;
cout<<"\t\t\t +-+-+-+-+-+-+-"<<endl;
cout<<"\n\t\t Enter Librarian Password ";
cin>>N ;
if(N==1234)
{ clrscr();
cout<<"\t\t\t Main Menu"<<endl;
cout<<"\t\t\t =-=-=-=-="<<endl;
cout<<" 1.Inventory \n 2.Availibility \n
3.Issuing \n 4.Returns \n 5.New Member \n 6.Log Out\n
7.Display all books\n 8.Display all members"<<endl;
cout<<"Enter your choice ";
cin>>choice;
switch (choice)
{ case 1:
inventory();
break;
case 2:
avail();
break;
case 3:
issue(); break;
case 4:
returns();
break;
case 5:
newmember();
break;
case 6:
exit(0);
case 7:
book();
break;
case 8:
members();
break;
default:
cout<<"Wrong OPtion";
break;
}}
else
{cout<<"\t\t\t\a Incorrect Password ";
cout<<"\n\t\t\t "<<xc<<" chances left";
getch();
}
clrscr(); }
cout<<"Do you Want to use again 1.Yes 2. No
";
cin>>j;
}cout<<"Thanks For Using";
getch();
}

OUTPUT
SCREENS
LOGIN SCREEN

MAIN MENU

INVENTORY
AVAILABILITY OF BOOKS

ISSUING BOOKS

Adding New Members

EXIT

LIMITATION AND SUGGESTED


UPGRADATION
The project needs some upgradation
• Program should automatically generate a list
of students who does not deposit the book
within time limit.

BIBLIOGRAPHY
· Sumita Arora – Computer Science with C+
+.
· Senior friends
· Computer Science teacher

Вам также может понравиться