Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 43

DEPARTMENT OF COMPUTER APPLICATION

COCHIN UNIVERSITY OF SCIENCE AND TECHNOLOGY


COCHIN -22

PROJECT RECORD

LIBRART MANEGMENT SYSTEM


SUBMITTED BY-
NAME-DEEPAK KUMAR
REG NO-38118022
DEPARTMET OF COMPUTER APPLICATION
COCHIN UNIVERSITY OF SCIENCE AND TECHNOLOGY
COCHIN-22

CERTIFICATE

Certified that this is “LIBRARY MANEGMENT SYSTEM” project full documentation done
by “DEEPAK KUMAR” Reg.No 38118022 for the course “ MASTER OF COMPUTER
APPLICATION “during the academic year 2018-21 for the language “c++” as a mini
project of 2nd semester at cochin university of science and technology
Cochin-22

Internal Examiner Head of the Department


DCA CUSAT
Department of Computer Application
CUSAT
LIBRARY MANEGMENT SYSTEM

ACKNOWLEDGEMENT

With great pleasure we hereby acknowledge that the help given to us by various
individuals throughout the project/ the project itself is an acknowledgement to
the inspiration driven and technical assistance contributed by many individuals.

We extend our sincere thanks to all the non-teaching staff for providing the
necessary facilities and help. We thank Lord God, the almighty for His immeasurable
blessing upon my life.

We are pleased our indebtedness to Dr. SABU, Head of the Department,


Department of Computer Application, CUSAT for his gracious encouragement

And also we are thankful to RAHUL, our project guide for his support . We are
obliged to the teaching staff for being helpful and co-operative during the period of
project . We extend our heartfelt thankful to parents, friends and well wishes for their
support and timely help.

DEPARTMENT OF COMPUTER APPLICATION


Page | 1
LIBRARY MANEGMENT SYSTEM

TABLE OF CONTENT

1. ABSTRACT…………………………………………………………….3
2. INTRODUCTION……………………………………………………...4
2.1 PROBLEM DESCRIPTION…………………………………...4
3. SYSTEM DESIGN……………………………………..........................5
3.1 FLOWCHART OR ALGORITHM……………………………5
3.2 MODULE DESCRIPTION………………………………………7
4. EXPERIMENT ANALYSIS…………………………………….. …...8
4.1 INPUT DESIGN…………………………………………………….8
4.2 OUTPUT DESIGN………………………………………………...10
5. CONCLUSION………………………………………………………..11

BIBLIOGRAPHY…………………………………………………….12
ERD………………………………………………………………........13
APPENDIX (SCREEN SHOT AND SAMPLE CODE)……………14

DEPARTMENT OF COMPUTER APPLICATION


Page | 2
LIBRARY MANEGMENT SYSTEM

1. ABSTRACT

The “LIBRARY MANEGMENT SYSTEM“ project is designed to help to manage the library
system in college and school. It provides the facilities to manage all the books into the
library. The existing system is very difficult to manage manually ,so here we are
providing a simple library manegment system .

It is a software developed for managing various allotment of books. For past few
years,numbers of educational institutions are increasing rapidly. Thereby numbers of
library are also increasing for the students for studying in the institution. And hence
there is a lot of strains on the person who are running hostel and software’s are not
usually used in this context.This particular projects deal with the problem of managing
allotment in library.

DEPARTMENT OF COMPUTER APPLICATION


Page | 3
LIBRARY MANEGMENT SYSTEM

2. INTRODUCTION

2.1 PROBLEM DESCRIPTION

This project is aimed to develop a “LIBRARY MANEGMENT SYSTEM” for a people to


get allotment easily. Existing system perform computation which was time consuming and
restrictive.

Some of the disadvantages of the existing system includes:


• Less efficient.
• Time and man power consuming.
• Speed of processing is low .
• Less convenient.

• Accuracy of existing system is very low due to the occur of errors


and difficulty of finding errors.

Because of this problems, we use LIBRARY MANEGMENT SYSTEM . This makes the
allotment easily. It handles the details regarding student details, BOOK ALLOTMENT
,membership of library etc. The good interaction with the user makes the system
convenient for use.
Authentication is necessary to enter into the system. The user who use the system
have his own security pin. The user can enter the system by entering login id and
password. So the system is secure.

DEPARTMENT OF COMPUTER APPLICATION


Page | 4
LIBRARY MANEGMENT SYSTEM

3. SYSTEM DESIGN

3.1 ALGORITHM

Step 1 : Start

Step 2 : Enter into the system using login id and password.

Step 3: Select admin mode or user mode .

Step 4: If account exist then enter your security pin .Select any option from Menu
Such as show add book , search book,add member,delete member ,etc.
Step 5: Select the mode of user
1 for admin mode
2 for user mode
Step 6: If choice is add book go to 1
If choice is to issue book go to 2.

If choice is add membership go to 3.

If choice is remove membership go to 4.

If choice is view member ship go to 5.

If choice is view book stock go to 6.

If choice is deposite book go to 7.

If choice is exit from admin mode go to 8 .


User mode
If choice is for serach book in user mode go to 1 .
If choice is for view stock of book go to 2.

If choice is search for view membership go to 3.

If choice is logout from user mode go to 4 .


Exit mode
If choice is logout from user mode go to 3

DEPARTMENT OF COMPUTER APPLICATION


Page | 5
DEPARTMENT OF COMPUTER APPLICATION
Page | 6
LIBRARY MANEGMENT SYSTEM

3.2 MODULE DESCRIPTION

The users of “HOSTEL ALLOTMENT SYSTEM” reside at one level ie User. In this project
we use sql to handle and store the information. This project contain the modules:

1. User Module.
The user can be any person using software. They can get allotted room
according to the room availability.
Admin mode
Member entry
Take a admission of a new membership
BOOK entry:
admin can entry book details.

Book issue
Librarian can issue book to students.

Delete record:
Student records can be deleted by admin when he/she left the validity .
View Stock :
Here we will saw the all details of available book
Deposite book:
After issueing of book we can also deposite the book

DEPARTMENT OF COMPUTER APPLICATION


Page | 7
LIBRARY MANEGMENT SYSTEM

4. EXPERIMENTAL ANALYSIS

4.1 INPUT DESIGN

This project system intakes so many inputs and work according to these inputs.
Inputs are given by the user. In the first login user has to enter account no

If user has entered correct login id, then he can proceed . If doesn’t enter correct
details then either he will have to exit.

The sample input window is given below:-

DEPARTMENT OF COMPUTER APPLICATION


Page | 8
LIBRARY MANEGMENT SYSTEM

4.2. ADMIN MENU DESIGN

DEPARTMENT OF COMPUTER APPLICATION


Page | 9
LIBRARY MANEGMENT SYSTEM

4.3 VIEW BOOK STOCK:

4.3 VIEW MEMBERSHIP:


4.3 ADD BOOK:

DEPARTMENT OF COMPUTER APPLICATION


Page | 10
4.3 MEMBER REGISTRATION
4.3 SEARCH BOOK:
LIBRARY MANEGMENT SYSTEM

5. CONCLUSION

The project entitled “LIBRARY MANEGMENT SYSTEM” was completed on time and we
tested it with the help of students. The main objective of the system is to reduce
time to issue the book manually .
The system generates regular and accurate output as per the user need. In comparison
with the existing system, the data is more relevant to the need of the user and contain
only the necessary information. By this system we can save the work time, effort and
provide accuracy.

It also provide security by means of security pin. We cover almost all the functional
aspects of a software. This system intends to maintain the requirements for a good
security system. Provide flexibility of using software, easy to understand, contain only
relevant information , these are all the peculiarities of our system.

To conclude this, we thank all people who help as to complete this project
work successful.

DEPARTMENT OF COMPUTER APPLICATION


Page | 11
LIBRARY MANEGMENT SYSTEM

BIBLIOGRAPHY

1. MASTERING C++ by K R VENUGOPAL and S R PRASAD

Sites used are:

www.tutorialspoint.com

www.stackoverflow.com

www.crazyprogrammer.com

www.geeksforgeeks.org

DEPARTMENT OF COMPUTER APPLICATION


Page | 12
MODE FLOW DIAGRAM VIEW
MEMBERS
SEARCH
BOOK

USER MODE

LOGOUT
VIEW
STOCK

ISSUE
VIEW BOOK
DEPOSITE
MEMBER
BOOK

ADD
BOOK ADMIN MODE
VIEW
STOCK

ADD SEARCH
MEMBER BOOK
ALGORITHM
Add Book:
Step 1:open file in append mode

Step 2: Take the input from the admin o insert the record

Step 3: we check that this is book is already in database or not

Step 4: if not then insert the record into file

Step 5: close the file

Add Member:
Step 1: open the file in append mode

Step 2: fill all the neccessory details into the variable

Step 3: we will check that this is already a member of library or not

Step 4: if not then insert the data into database

Step 5: if yes then give the error message

Step 6:close the opened file

View Stock:
Step 1: open the file in read mode

Step 2: it will be provide the details for searching

Step3:we retrieve the data from the file line by line

Step 4: it matched the condition and print the line

Step 5: close the file


View Membership :

Step 1: open the file in read mode

Step 2: it will be provide the details for searching

Step3:we retrieve the data from the file line by line

Step 4: it matched the condition and print the line

Step 5: close the file

Deposite Book:

Step 1: open the file

Step 2:fill the details and matched the condition from saved record

Step 3: if found then we will ask that want to deposite the book or reissue
the book

Step 4: if deposite then remove the allotted book details from the file

Step 5: if again reissue the book then assign new date of book issue

Step 5: update the book_issue record table

Step 6: close the file


LIBRARY MANEGMENT SYSTEM

ERD
LIBRARY MANEGMENT SYSTEM

APPENDIX

SOURCE CODE

#include<iostream>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<string.h>
#include<fstream>
#include<limits>
#include<sstream>
#include<ios>
using namespace std;
int mode;
class book
{
public:
int isbn,edition,quantity,age,validity,id;
string isbn1,edition1,quantity1,age1,validity1,id1;
long long int mobno;
char cr;
string tital,author,name,branch;
string line;
public:
int callmenu();
int add_book()
{
int flag=0;
system("cls");
cout<<" BOOK_DETAIL SHEET "<<endl;

cout<<"_______________________________________________________________________
___________"<<endl;
cout<<endl;
system("color 3f");
ofstream fout;
fout.open("book_record.dat",ios::app);
cout<<endl;
do
{
cout<<endl;
cout<<"Enter the ISBN no:";
cin>>isbn;
}
while(numeric_validatation(isbn,1)!=0);
while(isbn<0 || isbn>9999);
cin.ignore(numeric_limits<streamsize>::max(),'\n');
do
{
cout<<"Enter the TITAL of book:";
getline(cin,tital);
if (string_validation(tital)!=1)
{
if(tital.length()<=25)
{
for (int i=tital.length();i<=25;i++)
tital.insert(tital.length()," ");
}
break;
}
}
while(1);
do
{
cout<<"Enter the AUTHOR of book:";
getline(cin,author);
if (string_validation(author)!=1)
{
if(tital.length()<=25)
{
for (int i=tital.length();i<=25;i++)
tital.insert(tital.length()," ");
}
break;
}

}
while(1);
cout<<endl;
do
{
cout<<endl;
cout<<"Enter the Edition no:";
cin>>edition;
}
while(numeric_validatation(edition,0)!=0);
cout<<endl;
do
{
cout<<endl;
cout<<"Enter the QUANTITY:";
cin>>quantity;
}
while(numeric_validatation(quantity,0)!=0);
cout<<endl;
fout<<isbn<<"\t"<<tital<<"\t"<<author<<"\t"<<edition<<"\t"<<quantity<<endl;
// fout.write((char *)this,sizeof(*this));
cout<<"Book Sucessfully Added"<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
fout.close();
return 0;
}
int getbookdata()
{
cout<<isbn<<"\t"<<tital<<"\t"<<author<<"\t"<<edition<<"\t"<<quantity<<endl;
return 0;
}

int issue_book(){
system("cls");
system("color 1f");
cout<<" BOOK ISSUE DETAILS"<<endl;
cout<<"_______________________________________________________________________
________________________"<<endl;
int mid,flag=0,flag1=0;
string fname,lname, pname,sname,sbranch,issue_date;
string tit;
int sid,sage,ed,mob,bid;
cout<<endl;
do
{
cout<<" Enter the student id : ";
cin>>mid;
}
while(numeric_validatation(mid,0)!=0);
cout<<endl;
cout<<"_______________________________________________________________________
_________________________"<<endl;
ifstream fin;
fin.open("membership_register.dat");
while(getline(fin,line))
{
stringstream iss(line);
iss>>id>>fname>>lname>>age>>branch>>mobno;
if (id==mid)
{
flag=0;
sid=id;
cout<<endl;
cout<<"Name of Memeber:";
sname=fname+" "+lname;
// pname=sname;
if(sname.length()<=20)
{
for (int i=fname.length();i<=20;i++)
sname.insert(sname.length()," ");
}
//cout<<"length of name:"<<sname.length()<<endl;
cout<<sname;
cout<<endl;
cout<<endl;
cout<<"Branch Name : ";
sbranch=branch;
cout<<sbranch;
cout<<endl;
cout<<endl;
cout<<" Age : ";
sage=age;
cout<<sage;

/* cout<<"\t"<<"Mobile Number : ";


mob=mobno;
cout<<mob;*/
cout<<endl;
do
{
cout<<endl;
cout<<"ENTER ISBN N0 OF BOOK :";
cin>>bid;
}
while(numeric_validatation(bid,0));
ifstream fin1;
fin1.open("book_record.dat");
cout<<endl;
// cout<<" Book Details "<<endl;
//
cout<<"_______________________________________________________________________
_____________________"<<endl;
while(getline(fin1,line))
{
stringstream iss(line);
iss>>isbn>>tital>>author>>edition>>quantity;
if(bid==isbn)
{
cout<<" Book Status :Availlable !! "<<endl;
//cout<<line;
cout<<endl;
flag1=0;
break;
}
else
{
//cout<<"Book is not availlable "<<endl;
flag1=1;
}
}
if(flag1==1)
{
cout<<"Book Status :Not Availlable !!"<<endl;
cout<<"press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
}
else
{
do
{
cout<<endl;
cout<<"Enter Edition No:";
cin>>ed;
}
while(small_validation(ed));
cout<<endl;
cin.ignore(numeric_limits<streamsize>::max(),'\n');
do
{
cout<<" Enter Tital :";
getline(cin,tit);
if (string_validation(tit)==0)
{
if(tit.length()<16)
{
for (int i=tit.length();i<16;i++)
tit.insert(tit.length()," ");
}
break;
}
}
while(1);
// cin.ignore(numeric_limits<streamsize>::max(),'\n');
do
{
cout<<"Enter Issue Date of Book:";
cin>>issue_date;
}
while(date_validatation(issue_date));
fin1.close();
ofstream fout;
fout.open("issued_book.dat",ios::app);
fout<<sid<<"\t"<<bid<<"
"<<sname<<"\t"<<tit<<"\t"<<sbranch<<"\t"<<ed<<"\t"<<issue_date<<endl;
cout<<endl;
cout<<"BOOK issued successfully!!!!"<<endl;
fout.close();
}
break;
}
else
{
flag=1;
}
}
if (flag==1)
{
cout<<"!! Memeber id is not exit!! please register it "<<endl;
cout<<"press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
}
else
{
cout<<"Press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
}
fin.close();

}
int add_membership(){
system("cls");
system("color 1b");
ofstream fout;
fout.open("membership_register.dat",ios::app);
cout<<endl;
cout<<endl;
cout<<" MEMBERHIP REGISTRATION FORM"<<endl;
cout<<"_______________________________________________________________________
_____________________________"<<endl;
do
{
cout<<"Enter the Student Id :"<<endl;
cin>>id;
}
while(numeric_validatation(id,2));
cout<<endl;
cin.ignore(numeric_limits<streamsize>::max(),'\n');
do
{
cout<<"Enter the Name"<<endl;
getline(cin,name);
if(string_validation(name)!=1)
{
if(name.length()<=20)
{
for (int i=name.length();i<20;i++)
name.insert(name.length()," ");
}
break;
}
}
while(1);
cout<<endl;
//cin.ignore(numeric_limits<streamsize>::max(),'\n');
do
{
cout<<"Enter the Age:"<<endl;
cin>>age;
}
while(small_validation(age)!=0);
cout<<endl;
cin.ignore(numeric_limits<streamsize>::max(),'\n');
do
{
cout<< "Enter the Branch :"<<endl;
cin>>branch;
}
while(string_validation(branch));
cout<<endl;
cin.ignore(numeric_limits<streamsize>::max(),'\n');
do
{
cout<<"Enter the Mobile No:"<<endl;
cin>>mobno;
}
while(mob_validation(mobno));
cout<<endl;
//cin.ignore(numeric_limits<streamsize>::max(),'\n');
do
{
cout<<"Enter the Validity:"<<endl;
cin>>validity;
}
while(small_validation(validity));
cout<<endl;
fout<<id<<"\t"<<name<<"\t"<<"\t"<<age<<"\t"<<branch<<"\t"<<mobno<<"\t"<<validity<<"\t"
<<endl;
cout<<"\t"<<"\t"<<"Member Registration Successfull!!"<<endl;
cout<<"\t"<<"\t"<<"press any key to go into menu....."<<endl;
//cin.ignore(numeric_limits<streamsize>::max(),'\n');
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
fout.close();
return 0;
}
int remove_member(){
int mid;
char ch;
int c=0,flag=0;
system("cls");
system("color 3f");
cout<<" MEMEBER REMOVAL FORM "<<endl;
cout<<"_______________________________________________________________________
________________________"<<endl;
cout<<endl;
cout<<"Enter th Member Id:"<<endl;
cin>>mid;
ifstream fin;
fin.open("membership_register.dat");
if (fin.is_open()){
while(getline(fin,line))
{
c++;
stringstream iss(line);
iss>>id;
if(c==1)
{
cout<<line;
cout<<endl;
cout<<endl;
}
else if (c==2)
{
cout<<line;
cout<<endl;

cout<<"_______________________________________________________________________
______________________"<<endl;
}
else if(id==mid )
{
flag=1;
cout<<line;
cout<<endl;

cout<<"_______________________________________________________________________
________________________"<<endl;
// break;
}
}
fin.close();
ifstream fin;
fin.open("membership_register.dat");
if (flag==1)
{
cout<<"Searching found!!"<<endl;
cout<<endl;
cin.ignore(numeric_limits<streamsize>::max(),'\n');
cout<<"Do you want to Delete This \npress y/n"<<endl;
cin>>ch;
if (ch=='y')
{
ofstream fout;
fout.open("temp.dat");
while(getline(fin,line))
{
stringstream iss(line);
iss>>id;
if(mid!=id)
{
//cout<<"Deleted successfully!!"<<endl;
fout<<line<<endl;
cout<<endl;
}
else
{
cout<<"Deleted successfully!!"<<endl;
continue;
}
}
fout.close();
remove("membership_register.dat");
rename("temp.dat","membership_register.dat");
}
else
{
cout<<"press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
}
}
else
cout<<"Searching not found!!!"<<endl;
}
else
{
cout<<"ERROR:unable to open file"<<endl;
}
fin.close();
cout<<"press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}

}
int view_stock(){
ifstream fin;
cout<<"***********************************************************************
*********************************************************"<<endl;
fin.open("book_record.dat");
system("cls");
system("color 1d");
// cout<<" BOOK-RECORD"<<endl;
// cout<<"ISBN"<<"\t"<<"TITLE"<<"\t\t"<<"AUTHOR "<<"\t
"<<"EDITITON"<<"\t"<<"QUAN"<<endl;
//cout<<"______________________________________________________________________
________________________"<<endl;
if (!fin.is_open())
cout<<"Unable to open file"<<endl;
else
{
while(getline(fin,line))
{
cout<<line ;
cout<<endl;
cout<<"_______________________________________________________________________
______________________"<<endl;
}
}
cout<<"press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
fin.close();
return 0;
}
int deposite_book(){
int sid,isbn,mid;
int c=0;
int ch;
int flag=0;
system("cls");
system("color 3f");
cout<<" DEPOSITE BOOK SHEET"<<endl;
cout<<"_______________________________________________________________________
___________________"<<endl;
cout<<" Enter the ISBN Id:";
cin>>sid;
cout<<"_______________________________________________________________________
____________________"<<endl;
cout<<endl;
ifstream fin;
fin.open("issued_book.dat");
while (getline(fin,line))
{
c++;
stringstream iss(line);
iss>>mid>>isbn;
if ( c==2)
{
cout<<line;
cout<<endl;
}
else if ( sid==isbn)
{
flag=1;
cout<<line;
cout<<endl;
}
}
fin.close();
if (flag!=1)
{
cout<<"No Record found!!"<<endl;
cout<<"press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
}
else
{
cout<<endl;
cout<<"Do you Want to deposite book/reissue book "<<endl;
cout<<"press 1 for deposite "<<endl;
cout<<"press 2 for reissue "<<endl;
cin>>ch;
if (ch==1)
{
ifstream fin;
ofstream fout;
fout.open("temp.dat",ios::app);
fin.open("issued_book.dat");
while (getline(fin,line))
{
c++;
stringstream iss(line);
iss>>mid>>isbn;
if ( c==3||c==4 )
{
fout<<line<<endl;
//cout<<endl;
}
else if (isbn!=sid)
{
flag=1;
fout<<line<<endl;
}
}
if(flag==1)
cout<<"Book Deposited Successfully!!"<<endl;
fout.close();
fin.close();
remove("issued_book.dat");
rename("temp.dat","issued_book.dat");
cout<<"press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
}
cout<<"press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
}
}

int search_book(){
int svalue;
int position=-1;
int flag=0;
system("cls");
system("color 3f");
cout<<" SEARCH BOOK"<<endl;

cout<<"_______________________________________________________________________
______________"<<endl;
cout<<" Enter the ISBN to search the Book:";
cin>>svalue;
cout<<"_______________________________________________________________________
________________________"<<endl;
ifstream fin;
fin.open("book_record.dat");
cout<<endl;
cout<<" SEARCH-RECORD "<<endl;
cout<<endl;
cout<<"ISBN"<<"\t"<<"TITLE"<<"\t\t"<<"AUTHOR "<<"\t
"<<"EDITITON"<<"\t"<<"QUAN"<<endl;
cout<<"_______________________________________________________________________
__________________________"<<endl;
if (fin.is_open())
{
while(getline(fin,line))
{
stringstream iss(line);
iss>>isbn;
if(svalue==isbn)
{
cout<<line;
cout<<endl;

cout<<"_______________________________________________________________________
______________________"<<endl;
}

}
}

else
{
cout<<"cannot able open to file "<<endl;
}
cout<<"press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
}
int view_member(){
ifstream fin;
int ch,c=0,flag=0;
fin.open("membership_register.dat");
system("cls");
system("color 1f");
// cout<<"\t"<<"\t"<<"MEMBERSHIP "<<endl;
cout<<" MEMBER_DETAILS SHEET"<<endl;
//cout<<"id "<<"\t"<<"NAME"<<"\t"<<"\t"<<"AGE"<<" "<<"BRANCH"<<"
"<<"MOBIL3_NO"<<" "<<"VALIDITY"<<endl;

cout<<"_______________________________________________________________________
__________________________"<<endl;
cout<<" 1.Show Particular Memeber Details"<<endl;
cout<<" 2.Show ALL Memeber Details"<<endl;
cout<<" 3 Go to Menu"<<endl;
cout<<"_______________________________________________________________________
_____________________________"<<endl;
cout<<" Enter Choice : ";
cin>>ch;
cout<<"_______________________________________________________________________
______________________________"<<endl;
cout<<endl;
switch (ch)
{
case 1:
int mem_id;
cout<<endl;
do
{
cout<<" Enter Member ID:";
cin>>mem_id;
}
while(numeric_validatation(mem_id,0));
//ifstream fin1;
// fin1.open("issued_book.dat")
cout<<endl;
while(getline(fin,line))
{
c++;
stringstream iss(line);
iss>>id;
if (c==1 || c==2)
{
flag=0;
cout<<line;
cout<<endl;
cout<<endl;
}
else if(mem_id==id)
{
cout<<endl;
flag=0;
cout<<line;
cout<<endl;
cout<<endl;
break;
}
else
{
flag=1;
}
}
if (flag==1)
cout<<"No Record Found!!"<<endl;
cout<<"press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
view_member();
}
break;
case 2:
while (getline(fin,line))
{
cout<<line;
cout<<endl;
cout<<"_______________________________________________________________________
_________________________"<<endl;
}
cout<<"press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
view_member();
}
break;
case 3:
break;
default:
cout<<"invalid choicee ";
}
fin.close();
cout<<"\t"<<"Press any key to go into menu....."<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
callmenu();
}
}
int string_validation(string str)
{
int flag=0;
int bid;
do
{
cout<<endl;
if (str.length()<=0)
{
flag=1;
cout<<"Error: This Field canot be empty!!"<<endl;
break;
}
else if ( str.length()>=20)
{
flag=1;
cout<<"Error: size is very large !!"<<endl;
break;
}
else
{
if(str.length()<=25)
{
for(int i=0;i<str.length();i++)
{
if( (toascii(str[i])>=65 && toascii(str[i])<=90) || (toascii(str[i])>=97 &&
toascii(str[i])<=122) || toascii(str[i])==32)
{

flag=0;
}
else
{
flag=1;
break;
}

}
}
if (flag==1)
{
cout<<"Error: "<<str<<" is incurrect!!"<<endl;
cout<<" Only charecture and space are allowed!!"<<endl;
break;
}
}
}
while(flag!=0);
return flag;
}
int numeric_validatation(int num,int a)
{
int flag=0,bid;
if (num<=0)
{
cout<<"ERROR:"<<num<<" is invalid"<<endl;
cout<<"It must be positive "<<endl;
flag=1;
}
else if (num>9999)
{
cout<<"ERROR:"<<num<<"Exits Limit bound"<<endl;
cout<<"insert between 0 to 9999"<<endl;
flag=1;
}
else if (a==1)
{
ifstream fin;
fin.open("book_record.dat");
if (fin.is_open())
{
while (getline(fin,line))
{
stringstream iss(line);
iss>>bid;
if(bid==num)
{
flag=1;
cout<<"Error : ISBN number is already
present"<<endl;
break;
}
else
{
flag=0;
}
}
fin.close();
}
else
{
cout<<"Unable to open File "<<endl;
}
}
else if (a==2)
{
ifstream fin;
fin.open("membership_register.dat");
if (fin.is_open())
{
while (getline(fin,line))
{
stringstream iss(line);
iss>>bid;
if(bid==num)
{
flag=1;
cout<<"Error : Member Id is already present"<<endl;
break;
}
else
{
flag=0;
}
}
}
fin.close();
}
return flag;
}
int small_validation(int num)
{
int flag=0;
if (num<=0)
{
cout<<"ERROR:"<<num<<" is invalid"<<endl;
cout<<"It must be positive "<<endl;
flag=1;
}
else if (num>100)
{
cout<<"ERROR:"<<num<<"Exits Limit bound"<<endl;
cout<<"insert between 0 to 100"<<endl;
flag=1;
}
return flag;
}
int mob_validation(long long int mob)
{
int flag=0;
if (mob<=0)
{
cout<<"ERROR:"<<mob<<" is invalid"<<endl;
cout<<"It must be positive "<<endl;
flag=1;
}
else
{
int c=0;
while(mob>0)
{
mob=mob/10;
c++;
}
if (c==10)
flag=0;
else
{
flag=1;
cout<<"ERROR:Mobile number is not valid!! "<<endl;
cout<<"Mobile number will be 10 numberic value"<<endl;
}
}
return flag;
}
int date_validatation(string date)
{
int flag=0;
string y;
string d;
string m;
int d1=0,y1=0,m1=0;
d=date.substr(0,2);
m=date.substr(3,2);
y=date.substr(6,9);
for(int i=0;i<y.length();i++)
{
y1= (y1*10+(toascii(y[i])-48));
}
for(int i=0;i<m.length();i++)
{
m1= (m1*10+(toascii(m[i])-48));
}
for(int i=0;i<d.length();i++)
{
d1= (d1*10+(toascii(d[i])-48));
}
if ((d1>=1 && d1<=31) && (m1>=1 && m1<=12) && (y1>0000 && y1<=2019))
flag=0;
else
{
flag=1;
cout<<"Date is invalid"<<endl;
}
return flag;
}
int stringtonumber(string str)
{
int num=0,value;
for(int i=0;i<str.length();i++)
{
value=(toascii(str[i])-48);
if (value>=48 && value<=57)
num=(num*10)+value;
else
{
cout<<"Error:Only integer value"<<endl;
}
}
return num;
}

};
class menu:public book
{
book b,b1;
public:
int choice;
public:
virtual int user_menu()
{
system("cls");
system("color 3F");
cout<<"***********************************************************************
**************************"<<endl;
cout<<" COCHIN UNIVERSITY OF SCIENCE AND TECHNOLOGY
"<<endl;
cout<<"***********************************************************************
**************************"<<endl;
cout<<" LiBRARY MANEGMENT SYSTEM "<<endl;
cout<<" -------------------------- "<<endl;
cout<<" LOGGED AS USER "<<endl;
cout<<endl;
cout<<endl;
cout<<" USER MENU "<<endl;
cout<<" ___________ "<<endl;
cout<<" 1.SEARCH BOOK "<<endl;
cout<<" 2.VIEW STOCK "<<endl;
cout<<" 3.VIEW MEMBER "<<endl;
cout<<" 4.LOGOUT "<<endl;
cout<<endl;
cout<<" ENTER YOUR CHOICE : ";
cin>>choice;
switch (choice)
{
case 1:
b1.search_book();
break;
case 2:
b1.view_stock();
break;
case 3:
b1.view_member();
break;
case 4:
system("cls");
main_menu();
break;
default:
cout<<"incorrect choice"<<endl;
}
}
virtual int admin_menu()
{
// int choice;
system("cls");
system("color 3f");
cout<<"***********************************************************************
**************************"<<endl;
cout<<" COCHIN UNIVERSITY SCIENCE AND TECHNOLOGY ,KOCHI
"<<endl;
cout<<"***********************************************************************
**************************"<<endl;
cout<<" LiBRARY MANEGMENT SYSTEM "<<endl;
cout<<" -------------------------- "<<endl;
cout<<" LOGGED AS ADMIN "<<endl;
cout<<endl;
cout<<endl;
cout<<" ADMIN MENU "<<endl;
cout<<" ___________ "<<endl;
cout<<endl;
cout<<" 1.ADD BOOK "<<endl;
cout<<" 2.ISSUE BOOK "<<endl;
cout<<" 3.ADD MEMBERSHIP "<<endl;
cout<<" 4.REMOVE MEMBER "<<endl;
cout<<" 5.VIEW MEMEBER "<<endl;
cout<<" 6.VIEW STOCK "<<endl;
cout<<" 7.DEPOSITE BOOK "<<endl;
cout<<" 8.LOGOUT "<<endl;
cout<<endl;
cout<<" ENTER YOUR CHOICE :";
cin>>choice;
switch (choice)
{
case 1:
b.add_book();
break;
case 2:
b.issue_book();
break;
case 3:
b.add_membership();
break;
case 4:
b.remove_member();
break;
case 5:
b.view_member();
break;
case 6:
b.view_stock();
break;
case 7:
b.deposite_book();
break;
case 8:
system("cls");
main_menu();
default:
cout<<"invalid choice "<<endl;
}
}
virtual int main_menu()
{
char ch;
int choice;
char cr;
string password;
system("color 1F");
cout<<"***********************************************************************
**************************"<<endl;
cout<<" COCHIN UNIVERSITY SCIENCE AND TECHNOLOGY ,KOCHI
"<<endl;
cout<<"***********************************************************************
**************************"<<endl;
cout<<" LiBRARY MANEGMENT SYSTEM "<<endl;
cout<<" -------------------------- "<<endl;
cout<<" LOGIN AS "<<endl;
cout<<" -------- "<<endl;
cout<<"_______________________________________________________________________
__________________________"<<endl;
cout<<" 1.ADMIN 2.USER 3.EXIT "<<endl;
cout<<"_______________________________________________________________________
____________________________";
cout<<" ENTER YOU CHOICE.....";
cin>>ch;
mode=ch;
if(ch=='1')
{
cout<<endl;
cout<<" ENTER PASSWORD:";
cin>>password;
if (password=="ADMIN" || password=="admin")
{
admin_menu();
}
else
{
cout<<endl;
cout<<"Wrong password!again enter ..... ";
getch();
cr=cin.get();
if(toascii(cr)==10)
{
system("cls");
main_menu();
}

}
}
else if(ch=='2')
{
cout<<endl;
cout<<" ENTER PASSWORD:";
cin>>password;
if (password=="USER" || password=="user")
{
user_menu();
}
else
{
cout<<endl;
cout<<"incurrect password !try again.... "<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
system("cls");
main_menu();
}
}
}
else if (ch=='3')
exit(1);
else
{
cout<<"Incurrect selection!select 1 or 2 "<<endl;
getch();
cr=cin.get();
if(toascii(cr)==10)
{
system("cls");
main_menu();
}

}
return 0;
}

};
int book::callmenu()
{
menu m;
if (mode=='1')
m.admin_menu();
else if (mode=='2')
m.user_menu();
else
cout<<"invalid user mode "<<endl;
}

int main()
{
menu u1,u2;
u1.main_menu();
return 0;
}
DEPARTMENT OF COMPUTER APPLICATION
Page | 46
IBRARY MANEGMENT SYSTEM

2. FILE STORED DATA:


2.1 MEMBERSHIP DETAILS

2.2 BOOK RECORD DETAILS

DEPARTMENT OF COMPUTER APPLICATION


Page | 47
IBRARY MANEGMENT SYSTEM

2.
2.3 ISSUE BOOK DETAIL

DEPARTMENT OF COMPUTER APPLICATION


Page | 48

You might also like