SlideShare a Scribd company logo
1 of 45
Download to read offline
KENDRIYA VIDYALAYA,
NO.1, MADURAI
LIBRARY MANAGEMENT
SYSTEM
COMPUTER SCIENCE INVESTIGATORY
PROJECT
SUBMITTED BY
Under the guidance of
MR. AMAN GUPTA
KENDRIYA VIDYALAYA NO 1,
NARIMEDU, MADURAI-625002
KENDRIYA VIDYALAYA (NO 1)
NARIMEDU MADURAI-625002
COMPUTER SCIENCE
2013-2014
BONA FIDE CERTIFICATE
This is to certify that this project entitled “LIBRARY
MANAGEMENT SYSTEM” is a record of bona fide work carried
out by Vishnuprasad.V.P in Computer Science
prescribed by Kendriya Vidyalaya, Narimedu, Madurai -
625002.
ROLL NUMBER: DATE :
INTERNAL EXAMINER : PRINCIPAL :
EXTERNAL EXAMINER :
DECLARATION
I hereby declare that the project work entitled
“LIBRARY MANAGEMENT SYSTEM” submitted to KENDRIYA
VIDYALAYA NO.1, MADURAI for the subject Computer Science
under the guidance of MR. AMAN GUPTA is a record of
original work done by me. I further declare that this
project or any part of it has not been submitted elsewhere
for any other class.
Class:
Place:
Date:
ACKNOWLEDGEMENT
First and foremost, I praise and thank the god almighty from the
bottom of my heart, he who has been an unfailing source of
strength, comfort and inspiration in the completion of this project
work.
I wish to express my sincere thanks to Mr.C.MUTHIAH
Principal, Kendriya Vidyalaya (No.1), Madurai, for the successful
outcome of this project work.
I wish to express my deep and profound sense of gratitude to my
teacher and guiding light Mr. AMAN GUPTA (PGT CS) for his
expert and valuable guidance, comments and suggestions.
I also express my gratitude to my parents and friends who have
helped me in preparing this project.
CONTENTS
 Introduction
 Coding
 Output
 Bibliography
Coding
#include <iostream.h>
#include <fstream.h>
#include <process.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
#include<dos.h>
//STRUCTURE THAT INITIALIZES ALL THE VARIABLES
//____________________________________________
struct data
{
int tcode;
char tname[50];
char tauthor[50];
int tcopies;
float tprice;
int tavail;
}b1;
//CLASS THAT CONTROLS ALL FUNCTIONS IN THE MENU
//_____________________________________________
class MENU
{
public:
void introduction();
void main_menu();
void edit_menu() ;
void edit_book() ;
void edit_member() ;
void password();
};
//CLASS CONTAINING FUNCTIONS RELATED TO BOOKS
//___________________________________________
class BOOK
{
public :
void list(void) ;
char *bookname(int) ;
protected :
void add_new_book(int, char tname[33], char tauthor[26], float, int , int) ;
void update_copies(int, int, int) ;
void deletion(void) ;
int book_found(int) ;
int bookname_found(char []) ;
int recordno(int) ;
int available(int) ;
char *authorname(int) ;
float bookprice(int) ;
int no_of_copies(int) ;
int bookcodeof(char[]) ;
void display(int) ;
int reccount(void) ;
private :
int bookcode, copies ;
char name[40], author[27] ;
float price ;
int avail ;
};
//CLASS GOVERNING FUNCTIONS RELATED TO MEMBERS
//____________________________________________
class MEMBER
{
public :
void list(void) ;
protected :
void add_mem(int, int, char [], char [], char[], int, int, int) ;
int member_found(int) ;
void update_book(int, int, int, int, int) ;
char *membername(int) ;
char *memberphone(int) ;
char *memberaddress(int) ;
int recordno(int) ;
int lastcode(void) ;
int issued(int) ;
int fine(int) ;
void display(int) ;
void delete_rec(int) ;
private :
int memcode, bookcode ;
char name[27], phone[10], address[50] ;
int dd, mm, yy ; // DATE OF RETURNING THE BOOK //
};
//CLASS CONTAINING FUNCTIONS TO ISSUE, RETURN A BOOK, ETC..
//_________________________________________________________
class WORKING : public BOOK, public MEMBER
{
public :
void issuebook(void) ;
void returnbook(void) ;
void add_book(void) ;
void add_member(void) ;
void modify_book(void) ;
void modify_member(void) ;
void delete_book(void) ;
void delete_member(void) ;
} ;
//CLASS CONTAINING FUNCTIONS RELATED TO DATE
//__________________________________________
class DATE
{
public :
void extend_date(int,int,int,int) ;
int diff(int, int, int, int, int, int) ;
int day, mon, year ;
} ;
//FUNCTION TO EXTEND THE DATE BY 15 DAYS
//______________________________________
void DATE :: extend_date(int d1, int m1, int y1, int days)
{
static int month[] = {31,29,31,30,31,30,31,31,30,31,30,31};
for (int i=1; i<=days; i++)
{
d1++ ;
if ((d1 > month[m1-1]) || (y1%4 != 0 && m1 == 2 && d1 > 28))
{
d1 = 1 ;
m1++ ;
}
if (m1 > 12)
{
m1 = 1 ;
y1++ ;
}
}
day = d1 ;
mon = m1 ;
year = y1 ;
}
//FUNCTION TO RETURN THE DIFFERENCE B/W TWO DATES
//_______________________________________________
int DATE :: diff(int d1, int m1, int y1, int d2, int m2, int y2)
{
int days = 0 ;
if ((y2<y1) || (y2==y1 && m2<m1) || (y2==y1 && m2==m1 && d2<d1 ))
return days ;
static int month[] = {31,29,31,30,31,30,31,31,30,31,30,31} ;
while (d1 != d2 || m1 != m2 || y1 != y2)
{
days++ ;
d1++ ;
if ((d1 > month[m1-1]) || (y1%4 != 0 && m1 == 2 && d1 > 28))
{
d1 = 1 ;
m1++ ;
}
if (m1 > 12)
{
m1 = 1 ;
y1++ ;
}
}
return days ;
}
//FUNCTION TO DISPLAY MAIN MENU AND CONTROL ALL THE FUNCTIONS PRESENT IN IT
//_________________________________________________________________________
void MENU::main_menu()
{
while(1)
{
int ch;
clrscr();
gotoxy(26,2);
textbackground(WHITE);
textcolor(BLACK);
cprintf("WELCOME TO THE LIBRARY OF CONGRESS");
textcolor(BLACK);
gotoxy(26,3);
cout<<"***********************************";
gotoxy(31,7);
cout<<"1. INTRODUCTION";
gotoxy(31,8);
cout<<"2. ADD NEW BOOK";
gotoxy(31,9);
cout<<"3. ADD NEW MEMBER";
gotoxy(31,10);
cout<<"4. ISSUE A BOOK";
gotoxy(31,11);
cout<<"5. RETURN A BOOK";
gotoxy(31,12);
cout<<"6. LIST OF BOOKS";
gotoxy(31,13);
cout <<"7. LIST OF MEMBERS" ;
gotoxy(31,14) ;
cout <<"8. EDIT" ;
gotoxy(31,15) ;
cout <<"0. QUIT" ;
gotoxy(31,21);
cout <<"Enter your choice : " ;
cin>>ch;
WORKING W;
switch(ch)
{
case 1:
introduction();
break;
case 2:
W.add_book();
break;
case 3:
W.add_member();
break;
case 4:
W.issuebook();
break;
case 5:
W.returnbook() ;
break;
case 6:
BOOK B;
B.list();
break;
case 7:
MEMBER M;
M.list();
break;
case 8:
password();
break;
case 0:
exit(0);
default:
gotoxy(34,17);
cout<<"WRONG CHOICE!!";
}
getch();
}
}
//FUNCTION TO DISPLAY THE INTRODUCTION
//____________________________________
void MENU::introduction()
{
clrscr();
gotoxy(23,2);
cout<<"WELCOME TO LIBRARY MANAGEMENT SYSTEM";
gotoxy(23,3);
cout<<".....................................";
gotoxy(30,5);
cout<<"THE LIBRARY OF CONGRESS";
gotoxy(30,6);
cout<<"_______________________";
gotoxy(8,9);
cout <<"This is a project having the facility of maintaining the records" ;
gotoxy(29,11) ;
cout <<"of BOOKS and MEMBERS." ;
gotoxy(15,14) ;
cout <<"This project can hold the records of more than " ;
gotoxy(33,16) ;
cout <<"10,000 books" ;
gotoxy(2,25);
cout<<"AUTHORS : K.M.Subangan Rao, V. Muthukrishnan, V.P.
Vishnuprasad";
gotoxy(27,20);
textcolor(WHITE);
cout<<"PRESS ANY KEY TO CONTINUE : ";
textcolor(BLACK+BLINK);
getch();
}
//FUNCTION TO GET PASSWORD
//_________________________
void MENU:: password()
{
char pass1,pass2,pass3,ch;
clrscr();
gotoxy(27,12);
cout<<"ENTER PASSWORD : ";
pass1=getch();
cout<<"*";
pass2=getch();
cout<<"*";
pass3=getch();
cout<<"*";
if(pass1=='l'&&pass2=='i'&&pass3=='b')
{
gotoxy(28,13);
cout<<"WRONG PASSWORD!!";
main_menu();
}
else
{
clrscr();
gotoxy(28,13);
cout<<"WRONG PASSWORD!!";
}
}
//FUNCTION TO ASCERTAIN WHETHER THE BOOK CODE OR NAME IS PRESENT
//_____________________________________________________________
int BOOK ::book_found(int tcode)
{
fstream file;
file.open("BOOK.DAT",ios::in);
file.seekg(0,ios::beg);
int f;
while(file.read((char*)this,sizeof(BOOK)))
{
if(bookcode==tcode)
{
f=1;
break;
}
}
file.close();
return f;
}
int BOOK :: bookname_found(char t1code[35])
{
fstream file;
file.open("BOOK.DAT",ios::in);
file.seekg(0,ios::beg);
int g=0;
while(file.read((char*)this,sizeof(BOOK)))
{
if(!strcmpi(name,t1code))
{
g=1;
break;
}
}
file.close();
return g;
}
//FUNCTION TO RETURN THE RECORD NUMBER FOR A GIVEN BOOK
//______________________________________________________
int BOOK :: recordno(int tcode)
{
fstream file ;
file.open("BOOK.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
int count=0 ;
while (file.read((char *) this, sizeof(BOOK)))
{
count++ ;
if (bookcode == tcode)
break ;
}
file.close() ;
return count ;
}
//FUNCTION TO RETURN THE AVAILABLE COPIES FOR THE GIVEN BOOK CODE
//_______________________________________________________________
int BOOK :: available(int tcode)
{
fstream file ;
file.open("BOOK.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
int tavail=0 ;
while (file.read((char *) this, sizeof(BOOK)))
{
if (bookcode == tcode)
{
tavail = avail ;
break ;
}
}
file.close() ;
return tavail ;
}
//FUNCTION TO RETURN THE NUMBER OF COPIES FOR THE GIVEN BOOK CODE
//_______________________________________________________________
int BOOK :: no_of_copies(int tcode)
{
fstream file ;
file.open("BOOK.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
int tcopies=0 ;
while (file.read((char *) this, sizeof(BOOK)))
{
if (bookcode == tcode)
{
tcopies = copies ;
break ;
}
}
file.close() ;
return tcopies ;
}
//FUNCTION TO RETURN BOOK NAME OF THE GIVEN BOOK CODE
//___________________________________________________
char *BOOK :: bookname(int tcode)
{
fstream file ;
file.open("BOOK.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
char tname[33] ;
while (file.read((char *) this, sizeof(BOOK)))
{
if (bookcode == tcode)
{
strcpy(tname,name) ;
break ;
}
}
file.close() ;
return tname ;
}
//FUNCTION TO RETURN THE NAME OF THE AUTHOR FOR A GIVEN BOOK CODE
//_______________________________________________________________
char *BOOK :: authorname(int tcode)
{
fstream file ;
file.open("BOOK.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
char tauthor[26] ;
while (file.read((char *) this, sizeof(BOOK)))
{
if (bookcode == tcode)
{
strcpy(tauthor,author) ;
break ;
}
}
file.close() ;
return tauthor ;
}
//FUNCTION TO RETURN THE PRICE OF A BOOK WHEN BOOK CODE IS ENTERED
//________________________________________________________________
float BOOK :: bookprice(int tcode)
{
fstream file ;
file.open("BOOK.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
float tprice=0.0 ;
while (file.read((char *) this, sizeof(BOOK)))
{
if (bookcode == tcode)
{
tprice = price ;
break ;
}
}
file.close() ;
return tprice ;
}
//FUNCTION TO RETURN THE BOOK CODE OF A GIVEN BOOK NAME
//_____________________________________________________
int BOOK :: bookcodeof(char t1code[33])
{
fstream file ;
file.open("BOOK.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
int tcode=0 ;
while (file.read((char *) this, sizeof(BOOK)))
{
if (!strcmpi(name,t1code))
{
tcode = bookcode ;
break ;
}
}
file.close() ;
return tcode ;
}
//FUNCTION TO RETURN THE NUMBER OF RECORDS IN THE FILE
//____________________________________________________
int BOOK :: reccount(void)
{
fstream file ;
file.open("BOOK.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
int count=0 ;
while (file.read((char *) this, sizeof(BOOK)))
count++ ;
file.close() ;
return count ;
}
//FUNCTION TO ADD A RECORD TO THE FILE
//____________________________________
void BOOK :: add_new_book(int tcode, char tname[33], char tauthor[26], float tprice, int tcopies,
int tavail)
{
fstream file ;
file.open("BOOK.DAT", ios::app,ios::out) ;
bookcode = tcode ;
strcpy(name,tname) ;
strcpy(author,tauthor) ;
price = tprice ;
copies = tcopies ;
avail = tavail ;
file.write((char*)&b1,sizeof(b1));
file.close() ;
}
//FUNCTION TO DISPLAY THE RECORDS FOR A GIVEN BOOK CODE
//_____________________________________________________
void BOOK :: display(int tcode)
{
fstream file ;
file.open("BOOK.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
while (file.read((char *) this, sizeof(BOOK)))
{
if (bookcode == tcode)
{
gotoxy(5,5) ;
cout <<"Book Code : " <<bookcode ;
gotoxy(5,7) ;
cout <<"Book Name : " <<name ;
gotoxy(5,8) ;
cout <<"Author Name : " <<author ;
gotoxy(5,9) ;
cout <<"Price : Rs." <<price ;
gotoxy(5,10) ;
cout <<"No. of copies existing : " <<copies ;
gotoxy(5,11) ;
cout <<"No. of copies available : " <<avail ;
break ;
}
}
file.close() ;
}
//FUNCTION TO DISPLAY THE LIST OF BOOKS
//_____________________________________
void BOOK :: list(void)
{
clrscr();
int row=6;
gotoxy(32,2);
cout <<" LIST OF BOOKS" ;
gotoxy(32,3) ;
cout <<" ~~~~~~~~~~~~~~~" ;
gotoxy(1,4) ;
cout <<" CODE BOOK NAME AUTHOR PRICE COPIES " ;
gotoxy(1,5) ;
cout << "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~";
fstream file;
int i=0;
file.open("BOOK.DAT",ios::in|ios::out);
while(1)
{
file.read((char*)&b1,sizeof(b1));
if(file.eof())
break;
cout<<"n";
gotoxy(4,row);
cout<<b1.tcode;
gotoxy(10,row);
cout<<b1.tname;
gotoxy(36,row);
cout<<b1.tauthor;
gotoxy(60,row);
cout<<b1.tprice;
gotoxy(75,row);
cout<<b1.tcopies;
b1.tavail=b1.tcopies;
gotoxy(54,row+1) ;
cprintf("STATUS: ") ;
textcolor(BLACK+BLINK) ;
cprintf("%d copies available",b1.tavail) ;
textbackground(BLACK) ; textcolor(LIGHTGRAY) ;
row=row+2;
}
file.close();
}
//FUNCTION TO CHECK WHETHER THE MEMBER CODE IS VALID OR NOT
//_________________________________________________________
int MEMBER :: member_found(int mcode){return 0;}
{
fstream file ;
file.open("MEMBER.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
int found=0 ;
while (file.read((char *) this, sizeof(MEMBER)))
{
if (memcode == mcode)
{
found = 1 ;
break ;
}
}
file.close() ;
return found ;
}
//FUNCTION TO RETURN 0 IF THE MEMBER HAS NOT ISSUED ANY BOOK
//__________________________________________________________
int MEMBER :: issued(int mcode){return 1;}
{
fstream file ;
file.open("MEMBER.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
int missue=0 ;
while (file.read((char *) this, sizeof(MEMBER)))
{
if (memcode == mcode)
{
missue = bookcode ;
break ;
}
}
file.close() ;
return missue ;
}
//FUNCTION TO CALCULATE & RETURN FINE AMOUNT FOR A GIVEN MEMBER CODE
//_________________________________________________________________
int MEMBER :: fine(int mcode)
{
DATE D ;
int d1, m1, y1 ;
struct date d;
getdate(&d);
d1 = d.da_day ;
m1 = d.da_mon ;
y1 = d.da_year ;
fstream file ;
file.open("MEMBER.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
int days, t_fine ;
while (file.read((char *) this, sizeof(MEMBER)))
{
if (memcode == mcode)
{
days = D.diff(dd,mm,yy,d1,m1,y1) ;
t_fine = days * 2 ;
break ;
}
}
file.close() ;
return t_fine ;
}
//FUNCTION TO RETURN THE LAST CODE OF THE MEMBER FILE
//___________________________________________________
int MEMBER :: lastcode(void)
{
fstream file ;
file.open("MEMBER.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
int mcode=0 ;
while (file.read((char *) this, sizeof(MEMBER)))
mcode = memcode ;
file.close() ;
return mcode ;
}
//FUNCTION TO RETURN THE MEMBER NAME FOR A GIVEN MEMBER CODE
//__________________________________________________________
char *MEMBER :: membername(int mcode)
{
fstream file ;
file.open("MEMBER.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
char mname[26] ;
while (file.read((char *) this, sizeof(MEMBER)))
{
if (memcode == mcode)
{
strcpy(mname,name) ;
break ;
}
}
file.close() ;
return mname ;
}
//FUNCTION TO RETURN THE PHONE MEMBER FOR A GIVEN MEMBER CODE
//___________________________________________________________
char *MEMBER :: memberphone(int mcode)
{
fstream file ;
file.open("MEMBER.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
char mphone[10] ;
while (file.read((char *) this, sizeof(MEMBER)))
{
if (memcode == mcode)
{
strcpy(mphone,phone) ;
break ;
}
}
file.close() ;
return mphone ;
}
//FUNCTION TO RETURN THE ADDRESS FOR A GIVEN MEMBER CODE
//______________________________________________________
char *MEMBER :: memberaddress(int mcode)
{
fstream file ;
file.open("MEMBER.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
char maddress[33] ;
while (file.read((char *) this, sizeof(MEMBER)))
{
if (memcode == mcode)
{
strcpy(maddress,address) ;
break ;
}
}
file.close() ;
return maddress ;
}
//FUNCTION TO RETURN THE RECORD NUMBER FOR THE GIVEN MEMBER CODE
//______________________________________________________________
int MEMBER :: recordno(int mcode)
{
fstream file ;
file.open("MEMBER.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
int count=0 ;
while (file.read((char *) this, sizeof(MEMBER)))
{
count++ ;
if (memcode == mcode)
break ;
}
file.close() ;
return count ;
}
//FUNCTION TO ADD RECORD INTO THE FILE FOR A GIVEN MEMBER CODE
//____________________________________________________________
void MEMBER :: add_mem(int mcode, int bcode, char mname[26], char maddress[33], char
mphone[10], int d1, int m1, int y1)
{
fstream file ;
file.open("MEMBER.DAT", ios::app) ;
memcode = mcode ;
bookcode = bcode ;
strcpy(name,mname) ;
strcpy(address,maddress) ;
strcpy(phone,mphone) ;
dd = d1 ;
mm = m1 ;
yy = y1 ;
file.write((char *) this, sizeof(MEMBER)) ;
file.close() ;
}
//FUNCTION TO DISPLAY THE RECORD FOR A GIVEN MEMBER CODE
//______________________________________________________
void MEMBER :: display(int mcode)
{
fstream file ;
file.open("MEMBER.DAT", ios::in);
file.seekg(0,ios::beg) ;
while (file.read((char *) this, sizeof(MEMBER)))
{
if (memcode == mcode)
{
gotoxy(5,3) ;
cout <<" Member Code # " <<mcode ;
gotoxy(5,4) ;
cout <<" ~~~~~~~~~~~~~~~~~" ;
gotoxy(5,6) ;
cout <<"Name : " <<name ;
gotoxy(5,7) ;
cout <<"Phone No : " <<phone ;
gotoxy(5,8) ;
cout <<"Address : " <<address ;
break ;
}
}
file.close() ;
}
//FUNCTION TO DISPLAY THE LIST OF MEMBERS
//_______________________________________
void MEMBER :: list(void)
{
clrscr() ;
BOOK B ;
int row = 6 , found=0, flag=0 ;
char ch ;
gotoxy(32,2) ;
cout <<"LIST OF MEMBERS" ;
gotoxy(31,3) ;
cout <<"===================" ;
gotoxy(1,4) ;
cout <<" CODE BOOK CODE NAME PHONE" ;
gotoxy(1,5) ;
cout
<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~" ;
fstream file ;
file.open("MEMBER.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
while (file.read((char *) this, sizeof(MEMBER)))
{
flag = 0 ;
delay(20) ;
found = 1 ;
gotoxy(2,row) ;
cout <<memcode ;
gotoxy(10,row) ;
cout <<bookcode ;
gotoxy(19,row) ;
cout <<name ;
gotoxy(48,row) ;
cout <<phone ;
textbackground(WHITE) ; textcolor(BLACK) ;
gotoxy(7,row+1) ;
if (bookcode == 0)
cprintf("BOOK NAME: (Not Issued)") ;
else
{
cprintf("BOOK NAME: %s",B.bookname(bookcode)) ;
gotoxy(42,row+1) ;
cprintf("Date of return: ") ;
textcolor(BLACK+BLINK) ;
cprintf("%d/%d/%d",dd,mm,yy) ;
}
textbackground(BLACK) ; textcolor(LIGHTGRAY) ;
if ( row == 22 )
{
flag = 1 ;
row = 6 ;
gotoxy(1,25) ;
cout <<"Press any key to continue or Press <ESC> to exit" ;
ch = getch() ;
if (ch == 27)
break ;
clrscr() ;
gotoxy(32,2) ;
cout <<"LIST OF MEMBERS" ;
gotoxy(31,3) ;
cout <<"==================" ;
gotoxy(1,4) ;
cout <<"CODE BOOK CODE NAME PHONE" ;
gotoxy(1,5) ;
cout
<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~" ;
}
else
row = row + 2 ;
}
if (!found)
{
gotoxy(5,10) ;
cout <<"nRecords not found" ;
}
if (!flag)
{
gotoxy(1,25) ;
cout <<"Press any key to continue..." ;
getche() ;
}
file.close () ;
}
//FUNCTION TO UPDATE THE RECORD IN THE FILE FOR A GIVEN BOOK CODE
//_______________________________________________________________
void BOOK :: update_copies(int tcode, int tcopies, int tavail)
{
fstream file ;
file.open("BOOK.DAT", ios::in) ;
fstream temp ;
temp.open("temp.dat", ios::out) ;
file.seekg(0,ios::beg) ;
while ( !file.eof() )
{
file.read((char *) this, sizeof(BOOK)) ;
if ( file.eof() )
break ;
if ( bookcode == tcode )
{
copies = tcopies ;
avail = tavail ;
temp.write((char *) this, sizeof(BOOK)) ;
}
else
temp.write((char *) this, sizeof(BOOK)) ;
}
file.close() ;
temp.close() ;
file.open("BOOK.DAT", ios::out) ;
temp.open("temp.dat", ios::in) ;
temp.seekg(0,ios::beg) ;
while ( !temp.eof() )
{
temp.read((char *) this, sizeof(BOOK)) ;
if ( temp.eof() )
break ;
file.write((char *) this, sizeof(BOOK)) ;
}
file.close() ;
temp.close() ;
}
//FUNCTION TO GET DATA TO ADD RECORD INTO THE BOOK FILE
//______________________________________________________
void WORKING :: add_book(void)
{
BOOK B;
char c;
clrscr();
fstream file("BOOK.DAT",ios::in|ios::app);
file.seekg(0,ios::end);
int pos=file.tellg();
gotoxy(25,9);
cout<<"Code No. : ";
b1.tcode=(pos/sizeof(B))+1 ;
cout<<b1.tcode;
do
{
b1.tcode++;
gotoxy(30,5);
cout<<"A D D B O O K S";
gotoxy(30,6);
cout<<"-----------------";
gotoxy(25,11);
cout<<"Name of the Book : ";
gotoxy(25,13);
cout<<"Name of the Author : ";
gotoxy(25,15);
cout<<"Price : ";
gotoxy(25,17);
cout<<"Number of Copies: ";
gotoxy(49,11);
gets(b1.tname);
gotoxy(49,13);
gets(b1.tauthor);
gotoxy(49,15);
cin>>b1.tprice;
gotoxy(49,17);
cin>>b1.tcopies;
char ch;
gotoxy(25,20);
cout<<"Do you want to save?(y/n) ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
clrscr();
add_new_book(b1.tcode,b1.tname,b1.tauthor,b1.tprice,b1.tcopies,b1.tavail);
}
b1.tavail = available(b1.tcode) + b1.tcopies ;
b1.tcopies = no_of_copies(b1.tcode) + b1.tcopies ;
gotoxy(25,23);
cout<<"Do you want to add more? (y/n) ";
cin>>c;
}while(c=='y');
file.close();
}
//FUNCTION TO DELETE THE RECORD FOR A GIVEN MEMBER CODE
//_____________________________________________________
void MEMBER :: delete_rec(int mcode)
{
fstream file ;
file.open("MEMBER.DAT", ios::in) ;
fstream temp ;
temp.open("temp.dat", ios::out) ;
file.seekg(0,ios::beg) ;
while ( !file.eof() )
{
file.read((char *) this, sizeof(MEMBER)) ;
if ( file.eof() )
break ;
if ( memcode != mcode )
temp.write((char *) this, sizeof(MEMBER)) ;
}
file.close() ;
temp.close() ;
file.open("MEMBER.DAT", ios::out) ;
temp.open("temp.dat", ios::in) ;
temp.seekg(0,ios::beg) ;
while ( !temp.eof() )
{
temp.read((char *) this, sizeof(MEMBER)) ;
if ( temp.eof() )
break ;
file.write((char *) this, sizeof(MEMBER)) ;
}
file.close() ;
temp.close() ;
}
//FUNCTION TO GET DATA TO ADDD RECORD INTO THE MEMBER FILE
//________________________________________________________
void WORKING :: add_member(void)
{
char ch ;
int mcode, bcode ;
char mname[31], mphone[11], maddress[41] ;
int d1, m1, y1 ;
mcode = lastcode() ;
if (mcode == 0)
{
add_mem(mcode,0,"null","null","null",0,0,0) ;
MEMBER::delete_rec(mcode) ;
}
mcode++ ;
do
{
int valid=0 ;
clrscr() ;
gotoxy(28,3) ;
cout <<"ADDITION OF THE MEMBERS" ;
gotoxy(28,4) ;
cout <<"------------------------";
gotoxy(72,1) ;
cout <<"<0>=Exit" ;
gotoxy(5,7) ;
cout <<" # Member Code " <<mcode ;
gotoxy(5,8) ;
cout <<"_______________" ;
gotoxy(5,10) ;
cout <<"Name : " ;
gotoxy(5,12) ;
cout <<"Phone No. : " ;
gotoxy(5,14) ;
cout <<"Address : " ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"Enter the name of the New Member : " ;
gotoxy(15,10) ; clreol() ;
gets(mname) ;
strupr(mname) ;
if (mname[0] == '0')
return ;
if (strlen(mname) < 1 || strlen(mname) > 30)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"7Enter correctly (Range: 1..30)" ;
getch() ;
}
}
while (!valid) ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"Enter Phone no. of the Member or Press <ENTER> for none
: " ;
gotoxy(15,12) ; clreol() ;
gets(mphone) ;
if (mphone[0] == '0')
return ;
if ((strlen(mphone) < 6 && strlen(mphone) > 0) || (strlen(mphone) > 10))
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"7Enter correctly...." ;
getch() ;
}
}
while (!valid) ;
if (strlen(mphone) == 0)
strcpy(mphone,"-") ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"Enter the Address of the New Member: " ;
gotoxy(15,14) ; clreol() ;
gets(maddress) ;
strupr(maddress) ;
if (maddress[0] == '0')
return ;
if (strlen(maddress) < 1 || strlen(maddress) > 32)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"7Enter correctly (Range: 1..40)" ;
getch() ;
}
}
while (!valid) ;
gotoxy(5,25) ; clreol() ;
do
{
gotoxy(5,17) ; clreol() ;
cout <<"Do you want to save? (y/n) : " ;
ch = getche() ;
ch = toupper(ch) ;
if (ch == '0')
return ;
}
while (ch != 'Y' && ch != 'N') ;
if (ch == 'Y')
{
bcode = 0 ;
d1 = 0 ;
m1 = 0 ;
y1 = 0 ;
add_mem(mcode,bcode,mname,maddress,mphone,d1,m1,y1) ;
mcode++ ;
}
do
{
gotoxy(5,19) ; clreol() ;
cout <<"Do you want to add more? (y/n) : " ;
ch = getche() ;
ch = toupper(ch) ;
if (ch == '0')
return ;
}
while (ch != 'Y' && ch != 'N') ;
}
while (ch == 'Y') ;
}
//FUNCTION TO UPDATE THE RECORD FOR A GIVEN MEMBER CODE
//______________________________________________________
void MEMBER :: update_book(int mcode, int tcode, int d1, int m1, int y1)
{
fstream file ;
file.open("MEMBER.DAT", ios::in) ;
fstream temp ;
temp.open("temp.dat", ios::out) ;
file.seekg(0,ios::beg) ;
while ( !file.eof() )
{
file.read((char *) this, sizeof(MEMBER)) ;
if ( file.eof() )
break ;
if ( memcode == mcode )
{
bookcode = tcode ;
dd = d1 ;
mm = m1 ;
yy = y1 ;
temp.write((char *) this, sizeof(MEMBER)) ;
}
else
temp.write((char *) this, sizeof(MEMBER)) ;
}
file.close() ;
temp.close() ;
file.open("MEMBER.DAT", ios::out) ;
temp.open("temp.dat", ios::in) ;
temp.seekg(0,ios::beg) ;
while ( !temp.eof() )
{
temp.read((char *) this, sizeof(MEMBER)) ;
if ( temp.eof() )
break ;
file.write((char *) this, sizeof(MEMBER)) ;
}
file.close() ;
temp.close() ;
}
//FUNCTION TO ISSUE THE BOOK
//__________________________
void WORKING :: issuebook(void)
{
BOOK B ;
MEMBER M ;
DATE D ;
char t1code[33], ch ;
int t2code=0, tcode=0, mcode=0 ;
int valid ;
int d1, m1, y1 ;
struct date d;
getdate(&d);
d1 = d.da_day ;
m1 = d.da_mon ;
y1 = d.da_year ;
do
{
valid = 1 ;
while (1)
{
clrscr() ;
gotoxy(5,2) ;
cout <<"Date : " <<d1 <<"/" <<m1 <<"/" <<y1 ;
gotoxy(72,1) ;
cout <<"<0>=Exit" ;
gotoxy(5,5) ;
cout <<"Enter Code or Name of the Book to be issued" ;
gotoxy(5,6) ;
cout <<" or " ;
gotoxy(5,7) ;
cout <<"Press <ENTER> for help " ;
gets(t1code);
if (strlen(t1code) == 0)
B.list() ;
else
break ;
}
if ((tcode == 0 && !bookname_found(t1code)) || (tcode != 0 &&
!book_found(tcode)))
{
valid = 0 ;
gotoxy(5,10) ;
cout <<"7Record not found!!" ;
gotoxy(5,11) ;
cout <<"Press <ESC> to exit or any other key to continue..." ;
ch = getch() ;
if (ch == 27)
return ;
}
}
while (!valid) ;
if (tcode == 0)
tcode = bookcodeof(t1code) ;
if (!available(tcode))
{
gotoxy(5,10) ;
cout <<"7Sorry!! Book (" <<bookname(tcode) <<") is not available" ;
gotoxy(5,11) ;
cout <<"Kindly issue any other Book" ;
gotoxy(5,12) ;
cout <<"See List of Books" ;
getch() ;
return ;
}
do
{
valid = 1 ;
while (1)
{
clrscr() ;
gotoxy(72,1) ;
cout <<"<0>=Exit" ;
gotoxy(5,2) ;
cout <<"Date : " <<d1 <<"/" <<m1 <<"/" <<y1 ;
gotoxy(5,5) ;
cout <<"Book Name: " <<bookname(tcode) ;
gotoxy(5,7) ;
cout <<"Enter Code no. of the Member" ;
gotoxy(5,8) ;
cout <<" or " ;
gotoxy(5,9) ;
cout <<"Press <ENTER> for help " ;
gets(t1code) ;
if (t1code[0] == '0')
return ;
if (strlen(t1code) == 0)
M.list() ;
else
break ;
}
t2code = atoi(t1code) ;
mcode = t2code ;
if (mcode == 0)
{
valid = 0 ;
gotoxy(5,25) ;
cout <<"7Enter Correctly...." ;
getch() ;
}
if (!member_found(mcode) && valid)
{
valid = 0 ;
gotoxy(5,13) ;
cout <<"7Record not found!!" ;
gotoxy(5,14) ;
cout <<"Press <ESC> to exit or any other key to continue..." ;
ch = getch() ;
if (ch == 27)
return ;
}
}
while (!valid) ;
int tcopies, tavail ;
tcopies = no_of_copies(tcode) ; // Member function of BOOK
tavail = available(tcode) - 1 ; // Member function of BOOK
update_copies(tcode,tcopies,tavail) ; // Member function of BOOK
D.extend_date(d1,m1,y1,15) ;
d1 = D.day ;
m1 = D.mon ;
y1 = D.year ;
update_book(mcode,tcode,d1,m1,y1) ; // Member function of MEMBER
gotoxy(5,13) ;
cout <<"7Book has been issued to " <<membername(mcode) ;
gotoxy(5,15) ;
cout <<"Date of Return : " <<d1 <<"/" <<m1 <<"/" <<y1 ;
getch() ;
}
//FUNCTION TO RETURN THE BOOK
//____________________________
void WORKING :: returnbook(void)
{
MEMBER M ;
char t1code[5], ch ;
int t2code=0, mcode=0, valid ;
int d1, m1, y1 ;
struct date d;
getdate(&d);
d1 = d.da_day ;
m1 = d.da_mon ;
y1 = d.da_year ;
do
{
valid = 1 ;
while (1)
{
clrscr() ;
gotoxy(72,1) ;
cout <<"<0>=Exit" ;
gotoxy(5,2) ;
cout <<"Date : " <<d1 <<"/" <<m1 <<"/" <<y1 ;
gotoxy(5,7) ;
cout <<"Enter Code no. of the Member:" ;
gotoxy(5,8) ;
cout <<" or " ;
gotoxy(5,9) ;
cout <<"Press <ENTER> for help " ;
gets(t1code) ;
if (t1code[0] == '0')
return ;
if (strlen(t1code) == 0)
M.list() ;
else
break ;
}
if (mcode == 0)
{
valid = 0 ;
gotoxy(5,25) ;
cout <<"7Enter Correctly..." ;
getch() ;
}
if (!member_found(mcode) && valid)
{
valid = 0 ;
gotoxy(5,13) ;
cout <<"7Record not found!!" ;
gotoxy(5,14) ;
cout <<"Press <ESC> to exit or any other key to continue..." ;
ch = getch() ;
if (ch == 27)
return ;
}
if (!issued(mcode) && valid)
{
valid = 0 ;
gotoxy(5,13) ;
cout <<"7Member has no book to return!!" ;
gotoxy(5,14) ;
cout <<"Press <ESC> to exit or any other key to continue..." ;
ch = getch() ;
if (ch == 27)
return ;
}
}
while (!valid) ;
int bcode, tcopies, tavail ;
bcode = issued(mcode) ;
gotoxy(5,13) ;
cout <<"Book Code : " <<bcode ;
gotoxy(5,14) ;
cout <<"Book Name : " <<bookname(bcode) ;
tcopies = no_of_copies(bcode) ;
tavail = available(bcode) + 1 ;
int f ;
f = fine(mcode) ;
if (f != 0)
{
gotoxy(5,16) ;
cout <<"You are expected to pay a fine of Rs." <<f <<" due to late
submission";
gotoxy(5,17) ;
cout <<"Please do not delay the Return of Book again..." ;
}
update_copies(bcode,tcopies,tavail) ;
update_book(mcode,0,0,0,0) ;
gotoxy(5,19) ;
cout <<"7Book has been returned..." ;
getch() ;
}
//MAIN FUNCTION
//_____________
void main()
{
MENU menu;
menu.introduction();
menu.main_menu();
}
Output
Introduction Page
Main menu
Add Books Window
Add Books Window with Information
Add Members Window
Add members Window with Information
List of Members
List of Books
Bibliography
Computer Science with C++ - Sumita Arora
Turbo C++ Help
Codeblocks 10.05
www.agpgtcs.webs.com
www.cbsematerials.webnode.com

More Related Content

What's hot

Cbse computer science (c++) class 12 board project bank managment system
Cbse computer science (c++)  class 12 board project  bank managment systemCbse computer science (c++)  class 12 board project  bank managment system
Cbse computer science (c++) class 12 board project bank managment systempranoy_seenu
 
Phone book with project report for BCA,MCA
Phone book with project report for BCA,MCAPhone book with project report for BCA,MCA
Phone book with project report for BCA,MCASp Gurjar
 
Project for Student Result System
Project for Student Result SystemProject for Student Result System
Project for Student Result SystemKuMaR AnAnD
 
Library Management System
Library Management SystemLibrary Management System
Library Management SystemAditya Shah
 
c++ project on restaurant billing
c++ project on restaurant billing c++ project on restaurant billing
c++ project on restaurant billing Swakriti Rathore
 
Cbse class-xii-computer-science-project
Cbse class-xii-computer-science-project Cbse class-xii-computer-science-project
Cbse class-xii-computer-science-project Aniket Kumar
 
Book Shop Management System
Book Shop Management SystemBook Shop Management System
Book Shop Management SystemMuhammadRifat12
 
MOVIE TICKET BOOKING-COMPUTER SCIENCE C++ PROJECT
MOVIE TICKET BOOKING-COMPUTER SCIENCE C++ PROJECTMOVIE TICKET BOOKING-COMPUTER SCIENCE C++ PROJECT
MOVIE TICKET BOOKING-COMPUTER SCIENCE C++ PROJECTSindhu Ashok
 
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdfCOMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdfAkshatTiwari530170
 
Java PRACTICAL file
Java PRACTICAL fileJava PRACTICAL file
Java PRACTICAL fileRACHIT_GUPTA
 
Hotel Management system in C++
Hotel Management system in C++ Hotel Management system in C++
Hotel Management system in C++ Prince Kumar
 
Student information system project
Student information system projectStudent information system project
Student information system projectRizwan Ashraf
 
STUDENT REPORT CARD GENERATE SYSTEM
STUDENT REPORT CARD GENERATE SYSTEMSTUDENT REPORT CARD GENERATE SYSTEM
STUDENT REPORT CARD GENERATE SYSTEMvikram mahendra
 
c++ report file for theatre management project
c++ report file for theatre management projectc++ report file for theatre management project
c++ report file for theatre management projectRajesh Gangireddy
 
Harsh Mathur Final Year Project Report on Restaurant Billing System
Harsh  Mathur Final Year Project Report on Restaurant Billing SystemHarsh  Mathur Final Year Project Report on Restaurant Billing System
Harsh Mathur Final Year Project Report on Restaurant Billing SystemHarsh Mathur
 

What's hot (20)

Cbse computer science (c++) class 12 board project bank managment system
Cbse computer science (c++)  class 12 board project  bank managment systemCbse computer science (c++)  class 12 board project  bank managment system
Cbse computer science (c++) class 12 board project bank managment system
 
Bank Management System
Bank Management System Bank Management System
Bank Management System
 
Phone book with project report for BCA,MCA
Phone book with project report for BCA,MCAPhone book with project report for BCA,MCA
Phone book with project report for BCA,MCA
 
BANK MANAGEMENT SYSTEM report
BANK MANAGEMENT SYSTEM reportBANK MANAGEMENT SYSTEM report
BANK MANAGEMENT SYSTEM report
 
Project for Student Result System
Project for Student Result SystemProject for Student Result System
Project for Student Result System
 
Project Report
Project ReportProject Report
Project Report
 
E healthcare
E healthcare E healthcare
E healthcare
 
Library Management System
Library Management SystemLibrary Management System
Library Management System
 
c++ project on restaurant billing
c++ project on restaurant billing c++ project on restaurant billing
c++ project on restaurant billing
 
Cbse class-xii-computer-science-project
Cbse class-xii-computer-science-project Cbse class-xii-computer-science-project
Cbse class-xii-computer-science-project
 
Book Shop Management System
Book Shop Management SystemBook Shop Management System
Book Shop Management System
 
Library Management System
Library Management SystemLibrary Management System
Library Management System
 
MOVIE TICKET BOOKING-COMPUTER SCIENCE C++ PROJECT
MOVIE TICKET BOOKING-COMPUTER SCIENCE C++ PROJECTMOVIE TICKET BOOKING-COMPUTER SCIENCE C++ PROJECT
MOVIE TICKET BOOKING-COMPUTER SCIENCE C++ PROJECT
 
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdfCOMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
 
Java PRACTICAL file
Java PRACTICAL fileJava PRACTICAL file
Java PRACTICAL file
 
Hotel Management system in C++
Hotel Management system in C++ Hotel Management system in C++
Hotel Management system in C++
 
Student information system project
Student information system projectStudent information system project
Student information system project
 
STUDENT REPORT CARD GENERATE SYSTEM
STUDENT REPORT CARD GENERATE SYSTEMSTUDENT REPORT CARD GENERATE SYSTEM
STUDENT REPORT CARD GENERATE SYSTEM
 
c++ report file for theatre management project
c++ report file for theatre management projectc++ report file for theatre management project
c++ report file for theatre management project
 
Harsh Mathur Final Year Project Report on Restaurant Billing System
Harsh  Mathur Final Year Project Report on Restaurant Billing SystemHarsh  Mathur Final Year Project Report on Restaurant Billing System
Harsh Mathur Final Year Project Report on Restaurant Billing System
 

Viewers also liked

D & f block elements
D & f block elementsD & f block elements
D & f block elementsVishnu Prasad
 
The Canterville ghost
The Canterville ghostThe Canterville ghost
The Canterville ghostVishnu Prasad
 
Pop manutenção elétrica
Pop manutenção elétricaPop manutenção elétrica
Pop manutenção elétricaFcoAfonso
 
Pitch%20 for%20ivy
Pitch%20 for%20ivyPitch%20 for%20ivy
Pitch%20 for%20ivyMaia Legg
 
Shutter island teaser trailer analysis
Shutter island teaser trailer analysisShutter island teaser trailer analysis
Shutter island teaser trailer analysisMaia Legg
 
Evaluation question 2- How effective is the combination of your main product ...
Evaluation question 2- How effective is the combination of your main product ...Evaluation question 2- How effective is the combination of your main product ...
Evaluation question 2- How effective is the combination of your main product ...Maia Legg
 
Group feedback rough cut ivy
Group feedback rough cut ivyGroup feedback rough cut ivy
Group feedback rough cut ivyMaia Legg
 
COMUNICACIÓN ENTRE PROCESOS, TIPOS DE COMUNICACIÓN
COMUNICACIÓN ENTRE PROCESOS, TIPOS DE COMUNICACIÓNCOMUNICACIÓN ENTRE PROCESOS, TIPOS DE COMUNICACIÓN
COMUNICACIÓN ENTRE PROCESOS, TIPOS DE COMUNICACIÓNLuis Stifler
 
Warm bodies teaser trailer analysis
Warm bodies teaser trailer analysisWarm bodies teaser trailer analysis
Warm bodies teaser trailer analysisMaia Legg
 
Curso ar condicionado
Curso ar condicionadoCurso ar condicionado
Curso ar condicionadoFcoAfonso
 
Optics of human eye & refractive errors
Optics of human eye & refractive errorsOptics of human eye & refractive errors
Optics of human eye & refractive errorsSahithi Ganeshula
 

Viewers also liked (13)

D & f block elements
D & f block elementsD & f block elements
D & f block elements
 
The Canterville ghost
The Canterville ghostThe Canterville ghost
The Canterville ghost
 
Pop manutenção elétrica
Pop manutenção elétricaPop manutenção elétrica
Pop manutenção elétrica
 
Pitch%20 for%20ivy
Pitch%20 for%20ivyPitch%20 for%20ivy
Pitch%20 for%20ivy
 
Shutter island teaser trailer analysis
Shutter island teaser trailer analysisShutter island teaser trailer analysis
Shutter island teaser trailer analysis
 
Evaluation question 2- How effective is the combination of your main product ...
Evaluation question 2- How effective is the combination of your main product ...Evaluation question 2- How effective is the combination of your main product ...
Evaluation question 2- How effective is the combination of your main product ...
 
Group feedback rough cut ivy
Group feedback rough cut ivyGroup feedback rough cut ivy
Group feedback rough cut ivy
 
COMUNICACIÓN ENTRE PROCESOS, TIPOS DE COMUNICACIÓN
COMUNICACIÓN ENTRE PROCESOS, TIPOS DE COMUNICACIÓNCOMUNICACIÓN ENTRE PROCESOS, TIPOS DE COMUNICACIÓN
COMUNICACIÓN ENTRE PROCESOS, TIPOS DE COMUNICACIÓN
 
Warm bodies teaser trailer analysis
Warm bodies teaser trailer analysisWarm bodies teaser trailer analysis
Warm bodies teaser trailer analysis
 
Curso ar condicionado
Curso ar condicionadoCurso ar condicionado
Curso ar condicionado
 
Optics of human eye & refractive errors
Optics of human eye & refractive errorsOptics of human eye & refractive errors
Optics of human eye & refractive errors
 
Don boscoa soverato
Don boscoa soveratoDon boscoa soverato
Don boscoa soverato
 
Energia 81 l.m y.a
Energia 81 l.m y.aEnergia 81 l.m y.a
Energia 81 l.m y.a
 

Similar to Library management

Project fast food automaton
Project fast food automatonProject fast food automaton
Project fast food automatonvarun arora
 
CS Project-Source code for shopping inventory for CBSE 12th
CS Project-Source code for shopping inventory for CBSE 12thCS Project-Source code for shopping inventory for CBSE 12th
CS Project-Source code for shopping inventory for CBSE 12thSudhindra Mudhol
 
Computer mai ns project
Computer mai ns projectComputer mai ns project
Computer mai ns projectAayush Mittal
 
Computer mai ns project
Computer mai ns projectComputer mai ns project
Computer mai ns projectAayush Mittal
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13alish sha
 
Composition in JavaScript
Composition in JavaScriptComposition in JavaScript
Composition in JavaScriptJosh Mock
 
in this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfin this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfmichardsonkhaicarr37
 
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdfganisyedtrd
 

Similar to Library management (18)

Computer Investgatort Project (HOTEL MANAGEMENT SYSTEM)
Computer Investgatort Project (HOTEL MANAGEMENT SYSTEM)Computer Investgatort Project (HOTEL MANAGEMENT SYSTEM)
Computer Investgatort Project (HOTEL MANAGEMENT SYSTEM)
 
Project fast food automaton
Project fast food automatonProject fast food automaton
Project fast food automaton
 
Quiz using C++
Quiz using C++Quiz using C++
Quiz using C++
 
Baitap tkw
Baitap tkwBaitap tkw
Baitap tkw
 
CS Project-Source code for shopping inventory for CBSE 12th
CS Project-Source code for shopping inventory for CBSE 12thCS Project-Source code for shopping inventory for CBSE 12th
CS Project-Source code for shopping inventory for CBSE 12th
 
Computer mai ns project
Computer mai ns projectComputer mai ns project
Computer mai ns project
 
Computer mai ns project
Computer mai ns projectComputer mai ns project
Computer mai ns project
 
Durgesh
DurgeshDurgesh
Durgesh
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13
 
OOP.pptx
OOP.pptxOOP.pptx
OOP.pptx
 
Composition in JavaScript
Composition in JavaScriptComposition in JavaScript
Composition in JavaScript
 
Functional C++
Functional C++Functional C++
Functional C++
 
in this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfin this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdf
 
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
 
Writing MySQL UDFs
Writing MySQL UDFsWriting MySQL UDFs
Writing MySQL UDFs
 
Taller parcial 2
Taller parcial 2Taller parcial 2
Taller parcial 2
 
SQLAlchemy Seminar
SQLAlchemy SeminarSQLAlchemy Seminar
SQLAlchemy Seminar
 
Oop assignment 02
Oop assignment 02Oop assignment 02
Oop assignment 02
 

Recently uploaded

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 

Recently uploaded (20)

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 

Library management

  • 2. LIBRARY MANAGEMENT SYSTEM COMPUTER SCIENCE INVESTIGATORY PROJECT SUBMITTED BY Under the guidance of MR. AMAN GUPTA KENDRIYA VIDYALAYA NO 1, NARIMEDU, MADURAI-625002
  • 3. KENDRIYA VIDYALAYA (NO 1) NARIMEDU MADURAI-625002 COMPUTER SCIENCE 2013-2014 BONA FIDE CERTIFICATE This is to certify that this project entitled “LIBRARY MANAGEMENT SYSTEM” is a record of bona fide work carried out by Vishnuprasad.V.P in Computer Science prescribed by Kendriya Vidyalaya, Narimedu, Madurai - 625002. ROLL NUMBER: DATE : INTERNAL EXAMINER : PRINCIPAL : EXTERNAL EXAMINER :
  • 4. DECLARATION I hereby declare that the project work entitled “LIBRARY MANAGEMENT SYSTEM” submitted to KENDRIYA VIDYALAYA NO.1, MADURAI for the subject Computer Science under the guidance of MR. AMAN GUPTA is a record of original work done by me. I further declare that this project or any part of it has not been submitted elsewhere for any other class. Class: Place: Date:
  • 5. ACKNOWLEDGEMENT First and foremost, I praise and thank the god almighty from the bottom of my heart, he who has been an unfailing source of strength, comfort and inspiration in the completion of this project work. I wish to express my sincere thanks to Mr.C.MUTHIAH Principal, Kendriya Vidyalaya (No.1), Madurai, for the successful outcome of this project work. I wish to express my deep and profound sense of gratitude to my teacher and guiding light Mr. AMAN GUPTA (PGT CS) for his expert and valuable guidance, comments and suggestions. I also express my gratitude to my parents and friends who have helped me in preparing this project.
  • 7. Coding #include <iostream.h> #include <fstream.h> #include <process.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <ctype.h> #include <conio.h> #include<dos.h> //STRUCTURE THAT INITIALIZES ALL THE VARIABLES //____________________________________________ struct data { int tcode; char tname[50]; char tauthor[50]; int tcopies; float tprice; int tavail; }b1; //CLASS THAT CONTROLS ALL FUNCTIONS IN THE MENU //_____________________________________________ class MENU { public: void introduction(); void main_menu(); void edit_menu() ; void edit_book() ; void edit_member() ; void password(); }; //CLASS CONTAINING FUNCTIONS RELATED TO BOOKS
  • 8. //___________________________________________ class BOOK { public : void list(void) ; char *bookname(int) ; protected : void add_new_book(int, char tname[33], char tauthor[26], float, int , int) ; void update_copies(int, int, int) ; void deletion(void) ; int book_found(int) ; int bookname_found(char []) ; int recordno(int) ; int available(int) ; char *authorname(int) ; float bookprice(int) ; int no_of_copies(int) ; int bookcodeof(char[]) ; void display(int) ; int reccount(void) ; private : int bookcode, copies ; char name[40], author[27] ; float price ; int avail ; }; //CLASS GOVERNING FUNCTIONS RELATED TO MEMBERS //____________________________________________ class MEMBER { public : void list(void) ; protected : void add_mem(int, int, char [], char [], char[], int, int, int) ; int member_found(int) ; void update_book(int, int, int, int, int) ; char *membername(int) ; char *memberphone(int) ; char *memberaddress(int) ; int recordno(int) ; int lastcode(void) ; int issued(int) ; int fine(int) ;
  • 9. void display(int) ; void delete_rec(int) ; private : int memcode, bookcode ; char name[27], phone[10], address[50] ; int dd, mm, yy ; // DATE OF RETURNING THE BOOK // }; //CLASS CONTAINING FUNCTIONS TO ISSUE, RETURN A BOOK, ETC.. //_________________________________________________________ class WORKING : public BOOK, public MEMBER { public : void issuebook(void) ; void returnbook(void) ; void add_book(void) ; void add_member(void) ; void modify_book(void) ; void modify_member(void) ; void delete_book(void) ; void delete_member(void) ; } ; //CLASS CONTAINING FUNCTIONS RELATED TO DATE //__________________________________________ class DATE { public : void extend_date(int,int,int,int) ; int diff(int, int, int, int, int, int) ; int day, mon, year ; } ; //FUNCTION TO EXTEND THE DATE BY 15 DAYS //______________________________________ void DATE :: extend_date(int d1, int m1, int y1, int days) { static int month[] = {31,29,31,30,31,30,31,31,30,31,30,31}; for (int i=1; i<=days; i++) {
  • 10. d1++ ; if ((d1 > month[m1-1]) || (y1%4 != 0 && m1 == 2 && d1 > 28)) { d1 = 1 ; m1++ ; } if (m1 > 12) { m1 = 1 ; y1++ ; } } day = d1 ; mon = m1 ; year = y1 ; } //FUNCTION TO RETURN THE DIFFERENCE B/W TWO DATES //_______________________________________________ int DATE :: diff(int d1, int m1, int y1, int d2, int m2, int y2) { int days = 0 ; if ((y2<y1) || (y2==y1 && m2<m1) || (y2==y1 && m2==m1 && d2<d1 )) return days ; static int month[] = {31,29,31,30,31,30,31,31,30,31,30,31} ; while (d1 != d2 || m1 != m2 || y1 != y2) { days++ ; d1++ ; if ((d1 > month[m1-1]) || (y1%4 != 0 && m1 == 2 && d1 > 28)) { d1 = 1 ; m1++ ; } if (m1 > 12) { m1 = 1 ; y1++ ; } } return days ; } //FUNCTION TO DISPLAY MAIN MENU AND CONTROL ALL THE FUNCTIONS PRESENT IN IT //_________________________________________________________________________
  • 11. void MENU::main_menu() { while(1) { int ch; clrscr(); gotoxy(26,2); textbackground(WHITE); textcolor(BLACK); cprintf("WELCOME TO THE LIBRARY OF CONGRESS"); textcolor(BLACK); gotoxy(26,3); cout<<"***********************************"; gotoxy(31,7); cout<<"1. INTRODUCTION"; gotoxy(31,8); cout<<"2. ADD NEW BOOK"; gotoxy(31,9); cout<<"3. ADD NEW MEMBER"; gotoxy(31,10); cout<<"4. ISSUE A BOOK"; gotoxy(31,11); cout<<"5. RETURN A BOOK"; gotoxy(31,12); cout<<"6. LIST OF BOOKS"; gotoxy(31,13); cout <<"7. LIST OF MEMBERS" ; gotoxy(31,14) ; cout <<"8. EDIT" ; gotoxy(31,15) ; cout <<"0. QUIT" ; gotoxy(31,21); cout <<"Enter your choice : " ; cin>>ch; WORKING W; switch(ch) { case 1: introduction(); break; case 2: W.add_book(); break;
  • 12. case 3: W.add_member(); break; case 4: W.issuebook(); break; case 5: W.returnbook() ; break; case 6: BOOK B; B.list(); break; case 7: MEMBER M; M.list(); break; case 8: password(); break; case 0: exit(0); default: gotoxy(34,17); cout<<"WRONG CHOICE!!"; } getch(); } } //FUNCTION TO DISPLAY THE INTRODUCTION //____________________________________ void MENU::introduction()
  • 13. { clrscr(); gotoxy(23,2); cout<<"WELCOME TO LIBRARY MANAGEMENT SYSTEM"; gotoxy(23,3); cout<<"....................................."; gotoxy(30,5); cout<<"THE LIBRARY OF CONGRESS"; gotoxy(30,6); cout<<"_______________________"; gotoxy(8,9); cout <<"This is a project having the facility of maintaining the records" ; gotoxy(29,11) ; cout <<"of BOOKS and MEMBERS." ; gotoxy(15,14) ; cout <<"This project can hold the records of more than " ; gotoxy(33,16) ; cout <<"10,000 books" ; gotoxy(2,25); cout<<"AUTHORS : K.M.Subangan Rao, V. Muthukrishnan, V.P. Vishnuprasad"; gotoxy(27,20); textcolor(WHITE); cout<<"PRESS ANY KEY TO CONTINUE : "; textcolor(BLACK+BLINK); getch(); } //FUNCTION TO GET PASSWORD //_________________________ void MENU:: password() { char pass1,pass2,pass3,ch; clrscr(); gotoxy(27,12); cout<<"ENTER PASSWORD : "; pass1=getch(); cout<<"*"; pass2=getch(); cout<<"*"; pass3=getch(); cout<<"*"; if(pass1=='l'&&pass2=='i'&&pass3=='b') { gotoxy(28,13);
  • 14. cout<<"WRONG PASSWORD!!"; main_menu(); } else { clrscr(); gotoxy(28,13); cout<<"WRONG PASSWORD!!"; } } //FUNCTION TO ASCERTAIN WHETHER THE BOOK CODE OR NAME IS PRESENT //_____________________________________________________________ int BOOK ::book_found(int tcode) { fstream file; file.open("BOOK.DAT",ios::in); file.seekg(0,ios::beg); int f; while(file.read((char*)this,sizeof(BOOK))) { if(bookcode==tcode) { f=1; break; } } file.close(); return f; } int BOOK :: bookname_found(char t1code[35]) { fstream file; file.open("BOOK.DAT",ios::in); file.seekg(0,ios::beg); int g=0; while(file.read((char*)this,sizeof(BOOK))) { if(!strcmpi(name,t1code)) { g=1; break; }
  • 15. } file.close(); return g; } //FUNCTION TO RETURN THE RECORD NUMBER FOR A GIVEN BOOK //______________________________________________________ int BOOK :: recordno(int tcode) { fstream file ; file.open("BOOK.DAT", ios::in) ; file.seekg(0,ios::beg) ; int count=0 ; while (file.read((char *) this, sizeof(BOOK))) { count++ ; if (bookcode == tcode) break ; } file.close() ; return count ; } //FUNCTION TO RETURN THE AVAILABLE COPIES FOR THE GIVEN BOOK CODE //_______________________________________________________________ int BOOK :: available(int tcode) { fstream file ; file.open("BOOK.DAT", ios::in) ; file.seekg(0,ios::beg) ; int tavail=0 ; while (file.read((char *) this, sizeof(BOOK))) { if (bookcode == tcode) { tavail = avail ; break ; } }
  • 16. file.close() ; return tavail ; } //FUNCTION TO RETURN THE NUMBER OF COPIES FOR THE GIVEN BOOK CODE //_______________________________________________________________ int BOOK :: no_of_copies(int tcode) { fstream file ; file.open("BOOK.DAT", ios::in) ; file.seekg(0,ios::beg) ; int tcopies=0 ; while (file.read((char *) this, sizeof(BOOK))) { if (bookcode == tcode) { tcopies = copies ; break ; } } file.close() ; return tcopies ; } //FUNCTION TO RETURN BOOK NAME OF THE GIVEN BOOK CODE //___________________________________________________ char *BOOK :: bookname(int tcode) { fstream file ; file.open("BOOK.DAT", ios::in) ; file.seekg(0,ios::beg) ; char tname[33] ; while (file.read((char *) this, sizeof(BOOK))) { if (bookcode == tcode) { strcpy(tname,name) ; break ; } } file.close() ;
  • 17. return tname ; } //FUNCTION TO RETURN THE NAME OF THE AUTHOR FOR A GIVEN BOOK CODE //_______________________________________________________________ char *BOOK :: authorname(int tcode) { fstream file ; file.open("BOOK.DAT", ios::in) ; file.seekg(0,ios::beg) ; char tauthor[26] ; while (file.read((char *) this, sizeof(BOOK))) { if (bookcode == tcode) { strcpy(tauthor,author) ; break ; } } file.close() ; return tauthor ; } //FUNCTION TO RETURN THE PRICE OF A BOOK WHEN BOOK CODE IS ENTERED //________________________________________________________________ float BOOK :: bookprice(int tcode) { fstream file ; file.open("BOOK.DAT", ios::in) ; file.seekg(0,ios::beg) ; float tprice=0.0 ; while (file.read((char *) this, sizeof(BOOK))) { if (bookcode == tcode) { tprice = price ; break ; } } file.close() ;
  • 18. return tprice ; } //FUNCTION TO RETURN THE BOOK CODE OF A GIVEN BOOK NAME //_____________________________________________________ int BOOK :: bookcodeof(char t1code[33]) { fstream file ; file.open("BOOK.DAT", ios::in) ; file.seekg(0,ios::beg) ; int tcode=0 ; while (file.read((char *) this, sizeof(BOOK))) { if (!strcmpi(name,t1code)) { tcode = bookcode ; break ; } } file.close() ; return tcode ; } //FUNCTION TO RETURN THE NUMBER OF RECORDS IN THE FILE //____________________________________________________ int BOOK :: reccount(void) { fstream file ; file.open("BOOK.DAT", ios::in) ; file.seekg(0,ios::beg) ; int count=0 ; while (file.read((char *) this, sizeof(BOOK))) count++ ; file.close() ; return count ; } //FUNCTION TO ADD A RECORD TO THE FILE //____________________________________
  • 19. void BOOK :: add_new_book(int tcode, char tname[33], char tauthor[26], float tprice, int tcopies, int tavail) { fstream file ; file.open("BOOK.DAT", ios::app,ios::out) ; bookcode = tcode ; strcpy(name,tname) ; strcpy(author,tauthor) ; price = tprice ; copies = tcopies ; avail = tavail ; file.write((char*)&b1,sizeof(b1)); file.close() ; } //FUNCTION TO DISPLAY THE RECORDS FOR A GIVEN BOOK CODE //_____________________________________________________ void BOOK :: display(int tcode) { fstream file ; file.open("BOOK.DAT", ios::in) ; file.seekg(0,ios::beg) ; while (file.read((char *) this, sizeof(BOOK))) { if (bookcode == tcode) { gotoxy(5,5) ; cout <<"Book Code : " <<bookcode ; gotoxy(5,7) ; cout <<"Book Name : " <<name ; gotoxy(5,8) ; cout <<"Author Name : " <<author ; gotoxy(5,9) ; cout <<"Price : Rs." <<price ; gotoxy(5,10) ; cout <<"No. of copies existing : " <<copies ; gotoxy(5,11) ; cout <<"No. of copies available : " <<avail ; break ; } } file.close() ; }
  • 20. //FUNCTION TO DISPLAY THE LIST OF BOOKS //_____________________________________ void BOOK :: list(void) { clrscr(); int row=6; gotoxy(32,2); cout <<" LIST OF BOOKS" ; gotoxy(32,3) ; cout <<" ~~~~~~~~~~~~~~~" ; gotoxy(1,4) ; cout <<" CODE BOOK NAME AUTHOR PRICE COPIES " ; gotoxy(1,5) ; cout << " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~"; fstream file; int i=0; file.open("BOOK.DAT",ios::in|ios::out); while(1) { file.read((char*)&b1,sizeof(b1)); if(file.eof()) break; cout<<"n"; gotoxy(4,row); cout<<b1.tcode; gotoxy(10,row); cout<<b1.tname; gotoxy(36,row); cout<<b1.tauthor; gotoxy(60,row); cout<<b1.tprice; gotoxy(75,row); cout<<b1.tcopies; b1.tavail=b1.tcopies; gotoxy(54,row+1) ; cprintf("STATUS: ") ; textcolor(BLACK+BLINK) ; cprintf("%d copies available",b1.tavail) ; textbackground(BLACK) ; textcolor(LIGHTGRAY) ; row=row+2;
  • 21. } file.close(); } //FUNCTION TO CHECK WHETHER THE MEMBER CODE IS VALID OR NOT //_________________________________________________________ int MEMBER :: member_found(int mcode){return 0;} { fstream file ; file.open("MEMBER.DAT", ios::in) ; file.seekg(0,ios::beg) ; int found=0 ; while (file.read((char *) this, sizeof(MEMBER))) { if (memcode == mcode) { found = 1 ; break ; } } file.close() ; return found ; } //FUNCTION TO RETURN 0 IF THE MEMBER HAS NOT ISSUED ANY BOOK //__________________________________________________________ int MEMBER :: issued(int mcode){return 1;} { fstream file ; file.open("MEMBER.DAT", ios::in) ; file.seekg(0,ios::beg) ; int missue=0 ; while (file.read((char *) this, sizeof(MEMBER))) { if (memcode == mcode) { missue = bookcode ; break ; } }
  • 22. file.close() ; return missue ; } //FUNCTION TO CALCULATE & RETURN FINE AMOUNT FOR A GIVEN MEMBER CODE //_________________________________________________________________ int MEMBER :: fine(int mcode) { DATE D ; int d1, m1, y1 ; struct date d; getdate(&d); d1 = d.da_day ; m1 = d.da_mon ; y1 = d.da_year ; fstream file ; file.open("MEMBER.DAT", ios::in) ; file.seekg(0,ios::beg) ; int days, t_fine ; while (file.read((char *) this, sizeof(MEMBER))) { if (memcode == mcode) { days = D.diff(dd,mm,yy,d1,m1,y1) ; t_fine = days * 2 ; break ; } } file.close() ; return t_fine ; } //FUNCTION TO RETURN THE LAST CODE OF THE MEMBER FILE //___________________________________________________ int MEMBER :: lastcode(void) { fstream file ; file.open("MEMBER.DAT", ios::in) ; file.seekg(0,ios::beg) ; int mcode=0 ; while (file.read((char *) this, sizeof(MEMBER)))
  • 23. mcode = memcode ; file.close() ; return mcode ; } //FUNCTION TO RETURN THE MEMBER NAME FOR A GIVEN MEMBER CODE //__________________________________________________________ char *MEMBER :: membername(int mcode) { fstream file ; file.open("MEMBER.DAT", ios::in) ; file.seekg(0,ios::beg) ; char mname[26] ; while (file.read((char *) this, sizeof(MEMBER))) { if (memcode == mcode) { strcpy(mname,name) ; break ; } } file.close() ; return mname ; } //FUNCTION TO RETURN THE PHONE MEMBER FOR A GIVEN MEMBER CODE //___________________________________________________________ char *MEMBER :: memberphone(int mcode) { fstream file ; file.open("MEMBER.DAT", ios::in) ; file.seekg(0,ios::beg) ; char mphone[10] ; while (file.read((char *) this, sizeof(MEMBER))) { if (memcode == mcode) { strcpy(mphone,phone) ; break ; } }
  • 24. file.close() ; return mphone ; } //FUNCTION TO RETURN THE ADDRESS FOR A GIVEN MEMBER CODE //______________________________________________________ char *MEMBER :: memberaddress(int mcode) { fstream file ; file.open("MEMBER.DAT", ios::in) ; file.seekg(0,ios::beg) ; char maddress[33] ; while (file.read((char *) this, sizeof(MEMBER))) { if (memcode == mcode) { strcpy(maddress,address) ; break ; } } file.close() ; return maddress ; } //FUNCTION TO RETURN THE RECORD NUMBER FOR THE GIVEN MEMBER CODE //______________________________________________________________ int MEMBER :: recordno(int mcode) { fstream file ; file.open("MEMBER.DAT", ios::in) ; file.seekg(0,ios::beg) ; int count=0 ; while (file.read((char *) this, sizeof(MEMBER))) { count++ ; if (memcode == mcode) break ; } file.close() ; return count ; }
  • 25. //FUNCTION TO ADD RECORD INTO THE FILE FOR A GIVEN MEMBER CODE //____________________________________________________________ void MEMBER :: add_mem(int mcode, int bcode, char mname[26], char maddress[33], char mphone[10], int d1, int m1, int y1) { fstream file ; file.open("MEMBER.DAT", ios::app) ; memcode = mcode ; bookcode = bcode ; strcpy(name,mname) ; strcpy(address,maddress) ; strcpy(phone,mphone) ; dd = d1 ; mm = m1 ; yy = y1 ; file.write((char *) this, sizeof(MEMBER)) ; file.close() ; } //FUNCTION TO DISPLAY THE RECORD FOR A GIVEN MEMBER CODE //______________________________________________________ void MEMBER :: display(int mcode) { fstream file ; file.open("MEMBER.DAT", ios::in); file.seekg(0,ios::beg) ; while (file.read((char *) this, sizeof(MEMBER))) { if (memcode == mcode) { gotoxy(5,3) ; cout <<" Member Code # " <<mcode ; gotoxy(5,4) ; cout <<" ~~~~~~~~~~~~~~~~~" ; gotoxy(5,6) ; cout <<"Name : " <<name ; gotoxy(5,7) ; cout <<"Phone No : " <<phone ; gotoxy(5,8) ; cout <<"Address : " <<address ; break ; }
  • 26. } file.close() ; } //FUNCTION TO DISPLAY THE LIST OF MEMBERS //_______________________________________ void MEMBER :: list(void) { clrscr() ; BOOK B ; int row = 6 , found=0, flag=0 ; char ch ; gotoxy(32,2) ; cout <<"LIST OF MEMBERS" ; gotoxy(31,3) ; cout <<"===================" ; gotoxy(1,4) ; cout <<" CODE BOOK CODE NAME PHONE" ; gotoxy(1,5) ; cout <<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~" ; fstream file ; file.open("MEMBER.DAT", ios::in) ; file.seekg(0,ios::beg) ; while (file.read((char *) this, sizeof(MEMBER))) { flag = 0 ; delay(20) ; found = 1 ; gotoxy(2,row) ; cout <<memcode ; gotoxy(10,row) ; cout <<bookcode ; gotoxy(19,row) ; cout <<name ; gotoxy(48,row) ; cout <<phone ; textbackground(WHITE) ; textcolor(BLACK) ; gotoxy(7,row+1) ; if (bookcode == 0) cprintf("BOOK NAME: (Not Issued)") ; else
  • 27. { cprintf("BOOK NAME: %s",B.bookname(bookcode)) ; gotoxy(42,row+1) ; cprintf("Date of return: ") ; textcolor(BLACK+BLINK) ; cprintf("%d/%d/%d",dd,mm,yy) ; } textbackground(BLACK) ; textcolor(LIGHTGRAY) ; if ( row == 22 ) { flag = 1 ; row = 6 ; gotoxy(1,25) ; cout <<"Press any key to continue or Press <ESC> to exit" ; ch = getch() ; if (ch == 27) break ; clrscr() ; gotoxy(32,2) ; cout <<"LIST OF MEMBERS" ; gotoxy(31,3) ; cout <<"==================" ; gotoxy(1,4) ; cout <<"CODE BOOK CODE NAME PHONE" ; gotoxy(1,5) ; cout <<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~" ; } else row = row + 2 ; } if (!found) { gotoxy(5,10) ; cout <<"nRecords not found" ; } if (!flag) { gotoxy(1,25) ; cout <<"Press any key to continue..." ; getche() ; } file.close () ;
  • 28. } //FUNCTION TO UPDATE THE RECORD IN THE FILE FOR A GIVEN BOOK CODE //_______________________________________________________________ void BOOK :: update_copies(int tcode, int tcopies, int tavail) { fstream file ; file.open("BOOK.DAT", ios::in) ; fstream temp ; temp.open("temp.dat", ios::out) ; file.seekg(0,ios::beg) ; while ( !file.eof() ) { file.read((char *) this, sizeof(BOOK)) ; if ( file.eof() ) break ; if ( bookcode == tcode ) { copies = tcopies ; avail = tavail ; temp.write((char *) this, sizeof(BOOK)) ; } else temp.write((char *) this, sizeof(BOOK)) ; } file.close() ; temp.close() ; file.open("BOOK.DAT", ios::out) ; temp.open("temp.dat", ios::in) ; temp.seekg(0,ios::beg) ; while ( !temp.eof() ) { temp.read((char *) this, sizeof(BOOK)) ; if ( temp.eof() ) break ; file.write((char *) this, sizeof(BOOK)) ; } file.close() ; temp.close() ; }
  • 29. //FUNCTION TO GET DATA TO ADD RECORD INTO THE BOOK FILE //______________________________________________________ void WORKING :: add_book(void) { BOOK B; char c; clrscr(); fstream file("BOOK.DAT",ios::in|ios::app); file.seekg(0,ios::end); int pos=file.tellg(); gotoxy(25,9); cout<<"Code No. : "; b1.tcode=(pos/sizeof(B))+1 ; cout<<b1.tcode; do { b1.tcode++; gotoxy(30,5); cout<<"A D D B O O K S"; gotoxy(30,6); cout<<"-----------------"; gotoxy(25,11); cout<<"Name of the Book : "; gotoxy(25,13); cout<<"Name of the Author : "; gotoxy(25,15); cout<<"Price : "; gotoxy(25,17); cout<<"Number of Copies: "; gotoxy(49,11); gets(b1.tname); gotoxy(49,13); gets(b1.tauthor); gotoxy(49,15); cin>>b1.tprice; gotoxy(49,17); cin>>b1.tcopies; char ch; gotoxy(25,20); cout<<"Do you want to save?(y/n) "; cin>>ch; if(ch=='y'||ch=='Y')
  • 30. { clrscr(); add_new_book(b1.tcode,b1.tname,b1.tauthor,b1.tprice,b1.tcopies,b1.tavail); } b1.tavail = available(b1.tcode) + b1.tcopies ; b1.tcopies = no_of_copies(b1.tcode) + b1.tcopies ; gotoxy(25,23); cout<<"Do you want to add more? (y/n) "; cin>>c; }while(c=='y'); file.close(); } //FUNCTION TO DELETE THE RECORD FOR A GIVEN MEMBER CODE //_____________________________________________________ void MEMBER :: delete_rec(int mcode) { fstream file ; file.open("MEMBER.DAT", ios::in) ; fstream temp ; temp.open("temp.dat", ios::out) ; file.seekg(0,ios::beg) ; while ( !file.eof() ) { file.read((char *) this, sizeof(MEMBER)) ; if ( file.eof() ) break ; if ( memcode != mcode ) temp.write((char *) this, sizeof(MEMBER)) ; } file.close() ; temp.close() ; file.open("MEMBER.DAT", ios::out) ; temp.open("temp.dat", ios::in) ; temp.seekg(0,ios::beg) ; while ( !temp.eof() ) { temp.read((char *) this, sizeof(MEMBER)) ; if ( temp.eof() ) break ;
  • 31. file.write((char *) this, sizeof(MEMBER)) ; } file.close() ; temp.close() ; } //FUNCTION TO GET DATA TO ADDD RECORD INTO THE MEMBER FILE //________________________________________________________ void WORKING :: add_member(void) { char ch ; int mcode, bcode ; char mname[31], mphone[11], maddress[41] ; int d1, m1, y1 ; mcode = lastcode() ; if (mcode == 0) { add_mem(mcode,0,"null","null","null",0,0,0) ; MEMBER::delete_rec(mcode) ; } mcode++ ; do { int valid=0 ; clrscr() ; gotoxy(28,3) ; cout <<"ADDITION OF THE MEMBERS" ; gotoxy(28,4) ; cout <<"------------------------"; gotoxy(72,1) ; cout <<"<0>=Exit" ; gotoxy(5,7) ; cout <<" # Member Code " <<mcode ; gotoxy(5,8) ; cout <<"_______________" ; gotoxy(5,10) ; cout <<"Name : " ; gotoxy(5,12) ; cout <<"Phone No. : " ; gotoxy(5,14) ; cout <<"Address : " ; do {
  • 32. valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"Enter the name of the New Member : " ; gotoxy(15,10) ; clreol() ; gets(mname) ; strupr(mname) ; if (mname[0] == '0') return ; if (strlen(mname) < 1 || strlen(mname) > 30) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"7Enter correctly (Range: 1..30)" ; getch() ; } } while (!valid) ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"Enter Phone no. of the Member or Press <ENTER> for none : " ; gotoxy(15,12) ; clreol() ; gets(mphone) ; if (mphone[0] == '0') return ; if ((strlen(mphone) < 6 && strlen(mphone) > 0) || (strlen(mphone) > 10)) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"7Enter correctly...." ; getch() ; } } while (!valid) ; if (strlen(mphone) == 0) strcpy(mphone,"-") ; do
  • 33. { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"Enter the Address of the New Member: " ; gotoxy(15,14) ; clreol() ; gets(maddress) ; strupr(maddress) ; if (maddress[0] == '0') return ; if (strlen(maddress) < 1 || strlen(maddress) > 32) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"7Enter correctly (Range: 1..40)" ; getch() ; } } while (!valid) ; gotoxy(5,25) ; clreol() ; do { gotoxy(5,17) ; clreol() ; cout <<"Do you want to save? (y/n) : " ; ch = getche() ; ch = toupper(ch) ; if (ch == '0') return ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'Y') { bcode = 0 ; d1 = 0 ; m1 = 0 ; y1 = 0 ; add_mem(mcode,bcode,mname,maddress,mphone,d1,m1,y1) ; mcode++ ; } do {
  • 34. gotoxy(5,19) ; clreol() ; cout <<"Do you want to add more? (y/n) : " ; ch = getche() ; ch = toupper(ch) ; if (ch == '0') return ; } while (ch != 'Y' && ch != 'N') ; } while (ch == 'Y') ; } //FUNCTION TO UPDATE THE RECORD FOR A GIVEN MEMBER CODE //______________________________________________________ void MEMBER :: update_book(int mcode, int tcode, int d1, int m1, int y1) { fstream file ; file.open("MEMBER.DAT", ios::in) ; fstream temp ; temp.open("temp.dat", ios::out) ; file.seekg(0,ios::beg) ; while ( !file.eof() ) { file.read((char *) this, sizeof(MEMBER)) ; if ( file.eof() ) break ; if ( memcode == mcode ) { bookcode = tcode ; dd = d1 ; mm = m1 ; yy = y1 ; temp.write((char *) this, sizeof(MEMBER)) ; } else temp.write((char *) this, sizeof(MEMBER)) ; } file.close() ; temp.close() ;
  • 35. file.open("MEMBER.DAT", ios::out) ; temp.open("temp.dat", ios::in) ; temp.seekg(0,ios::beg) ; while ( !temp.eof() ) { temp.read((char *) this, sizeof(MEMBER)) ; if ( temp.eof() ) break ; file.write((char *) this, sizeof(MEMBER)) ; } file.close() ; temp.close() ; } //FUNCTION TO ISSUE THE BOOK //__________________________ void WORKING :: issuebook(void) { BOOK B ; MEMBER M ; DATE D ; char t1code[33], ch ; int t2code=0, tcode=0, mcode=0 ; int valid ; int d1, m1, y1 ; struct date d; getdate(&d); d1 = d.da_day ; m1 = d.da_mon ; y1 = d.da_year ; do { valid = 1 ; while (1) { clrscr() ; gotoxy(5,2) ; cout <<"Date : " <<d1 <<"/" <<m1 <<"/" <<y1 ; gotoxy(72,1) ;
  • 36. cout <<"<0>=Exit" ; gotoxy(5,5) ; cout <<"Enter Code or Name of the Book to be issued" ; gotoxy(5,6) ; cout <<" or " ; gotoxy(5,7) ; cout <<"Press <ENTER> for help " ; gets(t1code); if (strlen(t1code) == 0) B.list() ; else break ; } if ((tcode == 0 && !bookname_found(t1code)) || (tcode != 0 && !book_found(tcode))) { valid = 0 ; gotoxy(5,10) ; cout <<"7Record not found!!" ; gotoxy(5,11) ; cout <<"Press <ESC> to exit or any other key to continue..." ; ch = getch() ; if (ch == 27) return ; } } while (!valid) ; if (tcode == 0) tcode = bookcodeof(t1code) ; if (!available(tcode)) { gotoxy(5,10) ; cout <<"7Sorry!! Book (" <<bookname(tcode) <<") is not available" ; gotoxy(5,11) ; cout <<"Kindly issue any other Book" ; gotoxy(5,12) ; cout <<"See List of Books" ; getch() ; return ; } do
  • 37. { valid = 1 ; while (1) { clrscr() ; gotoxy(72,1) ; cout <<"<0>=Exit" ; gotoxy(5,2) ; cout <<"Date : " <<d1 <<"/" <<m1 <<"/" <<y1 ; gotoxy(5,5) ; cout <<"Book Name: " <<bookname(tcode) ; gotoxy(5,7) ; cout <<"Enter Code no. of the Member" ; gotoxy(5,8) ; cout <<" or " ; gotoxy(5,9) ; cout <<"Press <ENTER> for help " ; gets(t1code) ; if (t1code[0] == '0') return ; if (strlen(t1code) == 0) M.list() ; else break ; } t2code = atoi(t1code) ; mcode = t2code ; if (mcode == 0) { valid = 0 ; gotoxy(5,25) ; cout <<"7Enter Correctly...." ; getch() ; } if (!member_found(mcode) && valid) { valid = 0 ; gotoxy(5,13) ; cout <<"7Record not found!!" ; gotoxy(5,14) ; cout <<"Press <ESC> to exit or any other key to continue..." ; ch = getch() ;
  • 38. if (ch == 27) return ; } } while (!valid) ; int tcopies, tavail ; tcopies = no_of_copies(tcode) ; // Member function of BOOK tavail = available(tcode) - 1 ; // Member function of BOOK update_copies(tcode,tcopies,tavail) ; // Member function of BOOK D.extend_date(d1,m1,y1,15) ; d1 = D.day ; m1 = D.mon ; y1 = D.year ; update_book(mcode,tcode,d1,m1,y1) ; // Member function of MEMBER gotoxy(5,13) ; cout <<"7Book has been issued to " <<membername(mcode) ; gotoxy(5,15) ; cout <<"Date of Return : " <<d1 <<"/" <<m1 <<"/" <<y1 ; getch() ; } //FUNCTION TO RETURN THE BOOK //____________________________ void WORKING :: returnbook(void) { MEMBER M ; char t1code[5], ch ; int t2code=0, mcode=0, valid ; int d1, m1, y1 ; struct date d; getdate(&d); d1 = d.da_day ; m1 = d.da_mon ; y1 = d.da_year ; do { valid = 1 ; while (1) { clrscr() ; gotoxy(72,1) ; cout <<"<0>=Exit" ; gotoxy(5,2) ;
  • 39. cout <<"Date : " <<d1 <<"/" <<m1 <<"/" <<y1 ; gotoxy(5,7) ; cout <<"Enter Code no. of the Member:" ; gotoxy(5,8) ; cout <<" or " ; gotoxy(5,9) ; cout <<"Press <ENTER> for help " ; gets(t1code) ; if (t1code[0] == '0') return ; if (strlen(t1code) == 0) M.list() ; else break ; } if (mcode == 0) { valid = 0 ; gotoxy(5,25) ; cout <<"7Enter Correctly..." ; getch() ; } if (!member_found(mcode) && valid) { valid = 0 ; gotoxy(5,13) ; cout <<"7Record not found!!" ; gotoxy(5,14) ; cout <<"Press <ESC> to exit or any other key to continue..." ; ch = getch() ; if (ch == 27) return ; } if (!issued(mcode) && valid) { valid = 0 ; gotoxy(5,13) ; cout <<"7Member has no book to return!!" ; gotoxy(5,14) ; cout <<"Press <ESC> to exit or any other key to continue..." ; ch = getch() ; if (ch == 27) return ; }
  • 40. } while (!valid) ; int bcode, tcopies, tavail ; bcode = issued(mcode) ; gotoxy(5,13) ; cout <<"Book Code : " <<bcode ; gotoxy(5,14) ; cout <<"Book Name : " <<bookname(bcode) ; tcopies = no_of_copies(bcode) ; tavail = available(bcode) + 1 ; int f ; f = fine(mcode) ; if (f != 0) { gotoxy(5,16) ; cout <<"You are expected to pay a fine of Rs." <<f <<" due to late submission"; gotoxy(5,17) ; cout <<"Please do not delay the Return of Book again..." ; } update_copies(bcode,tcopies,tavail) ; update_book(mcode,0,0,0,0) ; gotoxy(5,19) ; cout <<"7Book has been returned..." ; getch() ; } //MAIN FUNCTION //_____________ void main() { MENU menu; menu.introduction(); menu.main_menu(); }
  • 42. Add Books Window Add Books Window with Information
  • 43. Add Members Window Add members Window with Information
  • 45. Bibliography Computer Science with C++ - Sumita Arora Turbo C++ Help Codeblocks 10.05 www.agpgtcs.webs.com www.cbsematerials.webnode.com