2. ACKNOWLEDGEMENT
I would like to convey my heartful thanks to
………………….(Computer Science) who
always gave valuable suggestions & guidance
for completion of my project.
He helped me to understand & remember
important details of the project. My project has
been a success only because of his guidance.
I am especially indented & I am also beholden
to my friends. And finally I thank to the
members of my family for their support &
encouragement.
3. CERTIFICATE
This is to certify that ………………….. of
………… of ………………………… has
completed his project under my supervision.
He has taken proper care & shown sincerity
in completion of this project.
I certify that this project is up to my
expectation & as per the guideline issued by
CBSE.
6. Introduction
The project is designed for school library in C++. The
title of the project is Library management system. In
this project a student can issue one book from library.
He has to submit it before 5 days. Otherwise fine will be
charged @ Re. 2/- for each day.
Administrator of the project can enter new book record,
display all/specific student record, he can modify and
delete student record. Administrator can enter new book
record, display all books modify book delete book
This project LIBRARY MANAGEMENT SYSTEM includes some
facilities of travel such as registration, search, display,
modification, delete etc. This software searches the
client data which is store in the record.
The software used for small schools for maintaining
there records related to library and cost savings.
7. //***************************************************************
// HEADER FILE USED IN PROJECT
//****************************************************************
#include<stdio.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>
#include<iomanip.h>
#include<string.h>
#include<ctype.h>
//********************functions names*************************************
void intro();int checkpass();void admin_menu();
void intromain();void student_info();void books_info();
void books_transcations();void reports();void write_student();
int getrollno();void modify_student_record(int n);void delete_student_record(int n);
void display_allstud_tabularform();void student_tabular();
void write_books();int getbookno();void modify_books_record(int n);
void delete_books_record(int n);void books_tabular();
void display_allbooks_tabularform();void write_transcation();
int gettransno();int getresult(int stno);void displaybooks(int bkno,int c);
int getposlimit(int n);void displaybookslimits();
void transaction();void return_transaction(int trno);
int getfineno();void booksofchoice(int bkno1);
void displaybookslimitswithstud(); void studentdetailbooks(int stno);
void studentdetailreturnbooks(int sno);
//************************************************************************
struct finemoney
{ int fno;
int stdno;
int total;
};
struct dateofissued
{ int dd;
int mm;
int yy;
};
struct bookslimit
{
int blno;
int bookno;
int limit;
};
struct fine
{
int fno;
8. int transno;
int studentno;
int fine;
};
//******************transcations class ***********************************
class trans
{ int tno; int studno; int bookno;
dateofissued dateiss,datereturn;
char status; public:
int gettno() { return tno; }
int getstudno()
{ return studno; }
int getbookno()
{ return bookno; }
dateofissued getdateiss()
{ return dateiss; }
dateofissued getdate()
{ return datereturn; }
char getstatus()
{ return status;}
void setstatus(char s1)
{ status=s1; }
void settrans(int t1,int stno,int bkno,dateofissued d1,dateofissued dret1,char stt)
{ tno=t1; studno=stno; bookno=bkno; dateiss=d1; datereturn=dret1; status=stt;
}
void showalltrans(int c)
{ gotoxy(3,c);
cout<<tno<<setw(10)<<studno<<setw(10)<<bookno<<setw(15)<<dateiss.dd<<"-"<<dateiss.mm<<"-“<<dateiss.yy
<<setw(15)<<datereturn.dd<<"-"<<datereturn.mm<<"-"<<datereturn.yy<<setw(10)<<status;
}};
//*******************transcation class ************************************
//*****************books class ******************************************
class books
{ int bno;
char booknm[25]; char pub[25]; char author[25];
float price; int qty;
public: int getbkno() { return bno; }
char *getbknm() { return booknm; }
char *getpub() { return pub; }
char *getauthor() { return author; }
float getprice() { return price; }
int getqty() { return qty; }
void setqty(int q1) { qty=q1; }
void setprice(float p) { price=p; }
//*************************add the book*******************************
void bookaddrecord(int bn)
{ gotoxy(5,7);
cout<<"======================================================================";
gotoxy(10,8); cout<<"BOOK NO:";
bno=bn; gotoxy(24,8); cout<<bno; gotoxy(10,9);
cout<<"----------------------------------------------------------------------";
gotoxy(10,10); cout<<"NAME OF BOOK:";
gotoxy(35,10); cin>>booknm;
gotoxy(10,11); cout<<"PUBLISHERS NAME";
gotoxy(35,11); cin>>pub;
gotoxy(10,12); cout<<"AUTHORS NAME";
gotoxy(35,12); cin>>author;
gotoxy(10,13); cout<<"PRICE:";
gotoxy(35,13); cin>>price;
gotoxy(10,14); cout<<"QUANTITY";
gotoxy(35,14); cin>>qty;
gotoxy(35,15);
cout<<"======================================================================";
} //*************************add the book*******************************
11. gotoxy(40,8); cout<<"FIRST NAME:"; gotoxy(60,8); cout<<fname;
gotoxy(10,9); cout<<"LAST NAME"; gotoxy(30,9); cout<<lname;
gotoxy(40,9); cout<<"STUDENT CLASS:"; gotoxy(60,9); cout<<stud_class;
gotoxy(10,10); cout<<"SECTION"; gotoxy(30,10); cout<<sec;
gotoxy(5,11); cout<<"============================================================";
}
//******************STUDENT MODIFY ************************************
void modifydata(int n1,char fnm[15],char lnm[15],char class_nm[5],char sec_nm[3]);
int getrno() { return stno; }};
void student::modifydata(int n1,char fnm[15],char lnm[15],char class_nm[5],char sec_nm[3])
{char tmpnm[40],tmpnm2[40],tmpclass[5],tmpsec[3];
gotoxy(5,14); cout<<"==============WANT TO MODIFY ===============================";
gotoxy(10,15); cout<<"STUDENT NO:"; stno=n1; gotoxy(25,15);
cout<<stno; gotoxy(40,15); strcpy(fname,fnm); cout<<"FIRST NAME:";
gotoxy(60,15); cout<<fname; gotoxy(10,17); cout<<"Want to change the First Name";
gotoxy(50,17); int flag=0;
while(1)
{gets(tmpnm);
if(strlen(tmpnm)!=0)
{ flag=1; break; }
if(strlen(tmpnm)==0)
{ flag=0; break; }
} if(flag==1)
{ strcpy(fname,tmpnm); }
gotoxy(5,18); strcpy(lname,lnm);
//****************COMPANY NAME TO BE MODIFY
cout<<"LAST NAME:"; gotoxy(20,18); cout<<lname; gotoxy(35,18);
cout<<"Want to change the Last Name"; gotoxy(65,18); flag=0;
while(1)
{ gets(tmpnm2);
if(strlen(tmpnm2)!=0) {
flag=1; break; }
if(strlen(tmpnm2)==0) { flag=0; break; }
}
if(flag==1)
{ strcpy(lname,tmpnm2); } //*****************class to be modify
gotoxy(5,19); strcpy(stud_class,class_nm);
//****************CLASS NAME TO BE MODIFY
cout<<"CLASS NAME:"; gotoxy(20,19); cout<<stud_class; gotoxy(35,19);
cout<<"Want to change the Class Name"; gotoxy(65,19); flag=0;
while(1)
{ gets(tmpclass);
if(strlen(tmpclass)!=0)
{ flag=1; break; }
if(strlen(tmpclass)==0)
{ flag=0; break; }
}
if(flag==1)
{ strcpy(stud_class,tmpclass); }
//****************************************************
gotoxy(5,20); cout<<"SECTION:"; strcpy(sec,sec_nm);
//****************CLASS SEC TO BE MODIFY
gotoxy(20,20); cout<<sec; gotoxy(35,20); cout<<"Want to change the Section";
gotoxy(65,20); flag=0;
while(1)
{ gets(tmpsec);
if(strlen(tmpsec)!=0)
{flag=1;break; }
if(strlen(tmpsec)==0)
{ flag=0; break; }
}
if(flag==1) { strcpy(sec,tmpsec); }
gotoxy(5,22); cout<<"=====================================================";
}//*********************welcome page*************************************
12. void intro()
{ clrscr(); gotoxy(4,2);
cout<<"***************************LIBRARY MANAGEMENT***************************";
gotoxy(12,4); cout<<"===========================================================";
gotoxy(5,5); cout<<"*********************S=Y=S=T=E=M********************************";
gotoxy(50,10); cout<<"PROJECT:";
gotoxy(50,12); cout<<"MADE BY : …………………………………………………………………";
gotoxy(8,14); cout<<"--------------------DOON PUBLIC SCHOOL,HALDWANI------------------------";
gotoxy(8,15); cout<<"------------------CLASS : XII B ( COMPUTER SCIENCE )-------------------";
getch();
}
void main()
{
char ch; intro();
if(checkpass()==0)
{ do {
clrscr(); intromain();
gotoxy(20,6);cout<<"=================MAIN MENU====================";
gotoxy(28,7);cout<<"01. REPORT GENERATOR";
gotoxy(28,8);cout<<"02. ADMINISTRATOR";
gotoxy(28,9);cout<<"03. EXIT";
gotoxy(20,10);cout<<"==============================================";
gotoxy(25,12);cout<<"Please Select Your Option (1-3) ";
gotoxy(30,14);ch=getche();
switch(ch)
{ case '1': reports(); break;
case '2': admin_menu(); break;
case '3':exit(0);
}
}while(ch!='3');}else{exit(0);}}
//****************************FUNCTIONS STARTS HERE************************
//******************************login name and password****************
int checkpass()
{
char nm[20];
char pass[10];
clrscr();
intromain();
gotoxy(20,20); cout<<"PLEASE ENTER THE USER NAME:";
gotoxy(20,21); cin>>nm; clrscr(); gotoxy(20,20);
cout<<"PLEASE ENTER THE PASSWORD:";
gotoxy(20,21); cin>>pass;
if(strcmp(nm,"admin")==0 && strcmp(pass,"vicky")==0)
{ return 0; }else { return 1; }
}
void intromain()
{ clrscr();
gotoxy(1,2);cout<<"*************LIBRARY****MANAGEMENT*****SYSTEM**********************";
gotoxy(1,3);cout<<"*******************************PROJECT***********************************";
}//**************************admin starts**********************************
void admin_menu()
{
clrscr();
char ch2='0';
clrscr();
intromain();gotoxy(20,6);
cout<<"=================ADMIN MENU====================";
gotoxy(22,7);cout<<"1.STUDENT INFORMATION";
gotoxy(22,8);cout<<"2.BOOKS INFORMATION";
gotoxy(22,9);cout<<"3.TRANSCATIONS";
gotoxy(22,10);cout<<"4.BACK TO MAIN MENU";
gotoxy(22,12);cout<<"Please Enter Your Choice (1-4) ";
gotoxy(23,16); ch2=getche();
switch(ch2)
13. {
case '1': student_info(); break;
case '2': books_info(); break;
case '3': books_transcations(); break;
case '4': break;
default: cout<<"a"; admin_menu();
}}
//**************************student information system*******************
void student_info()
{
clrscr();
int num;
char ch2='0';
clrscr();
intromain();gotoxy(20,6);
cout<<"=================STUDENT INFORMATION====================";
gotoxy(22,7);cout<<"1.ADD STUDENT INFORMATIONS";
gotoxy(22,8);cout<<"2.MODIFY STUDENT INFORMATIONS";
gotoxy(22,9);cout<<"3.DELETE STUDENT INFORMTIONS";
gotoxy(22,10);cout<<"4.BACK TO MENU";
gotoxy(22,12);cout<<"Please Enter Your Choice (1-4) ";
gotoxy(23,16);ch2=getche();
switch(ch2)
{
case '1':
clrscr(); intromain(); write_student();
break;
case '2':
clrscr();
intromain();
gotoxy(10,8);cout<<"***ENTER THE STUDENT ID TO BE SEARCHED AND MODIFY:";
gotoxy(55,9);cin>>num; modify_student_record(num);
break;
case '3':
clrscr();
intromain();
gotoxy(10,8);cout<<"***ENTER THE STUDENT ID TO BE SEARCHED AND DELETE:";
gotoxy(55,9);cin>>num; delete_student_record(num);
break;
case '4':break;
default:
cout<<"a"; admin_menu();
} }
//*****************books informations*****************************
void books_info()
{
clrscr();
int num=0;
char ch2='0';
clrscr();
intromain();gotoxy(20,6);
cout<<"=================BOOKS INFORMATION====================";
gotoxy(22,7);cout<<"1.ADD BOOKS INFORMATIONS";
gotoxy(22,8);cout<<"2.MODIFY BOOKS INFORMATIONS";
gotoxy(22,9);cout<<"3.DELETE BOOKS INFORMTIONS";
gotoxy(22,10);cout<<"4.BACK TO MENU";
gotoxy(22,12);cout<<"Please Enter Your Choice (1-4) ";
gotoxy(23,16);ch2=getche();
switch(ch2)
{
case '1': clrscr(); intromain(); write_books();
break;
case '2': clrscr(); intromain();
gotoxy(10,8);cout<<"***ENTER THE BOOK NO TO BE SEARCHED AND MODIFY:";
14. gotoxy(55,9);cin>>num; modify_books_record(num);
break;
case '3': clrscr();
intromain(); gotoxy(10,8);cout<<"***ENTER THE BOOK NO TO BE SEARCHED AND
DELETE:";
gotoxy(55,9);cin>>num; delete_books_record(num);
break;
case '4': break;
default: cout<<"a"; admin_menu();
} }
//*****************books transcations informations*****************************
void books_transcations()
{
clrscr(); char ch2='0';
int tnum=0; clrscr();
intromain();gotoxy(20,6);
cout<<"=================BOOKS TRANSCATIONS====================";
gotoxy(22,7);cout<<"1.ISSUE BOOKS TRANS";
gotoxy(22,8);cout<<"2.SUBMIT BOOKS TRANS";
gotoxy(22,9);cout<<"3.BACK TO MENU";
gotoxy(22,10);cout<<"Please Enter Your Choice (1-3) ";
gotoxy(23,12);ch2=getche();
switch(ch2)
{
case '1': write_transcation(); break;
case '2': clrscr(); intromain();gotoxy(10,8);
cout<<"***ENTER THE TRANS NO TO BE SEARCHED:";
gotoxy(55,9);cin>>tnum; return_transaction(tnum);
break;
case '3': break;
default: cout<<"a"; admin_menu();
} }
//*******************ALL Reports Display Menu************************
void reports()
{
clrscr();
char ch2='0';
int bookno=0,ch3=0,sno=0;
clrscr();
intromain();gotoxy(5,6);
cout<<"================================REPORTS===========================";
gotoxy(10,7);cout<<"1.All books Details";
gotoxy(10,8);cout<<"2.All students Details";
gotoxy(10,9);cout<<"3.Search and Display book details and total books issued";
gotoxy(10,10);cout<<"4.Student details no. of books return with/without fine deposit ";
gotoxy(10,11);cout<<"5.Display Student details With no. of books issued";
gotoxy(10,12);cout<<"6.books with limits and students to whome the book issued";
gotoxy(10,13);cout<<"7.All transcations";
gotoxy(10,14);cout<<"8.BACK TO MENU";
gotoxy(10,15);cout<<"Please Enter Your Choice (1-7) ";
gotoxy(11,16);ch2=getche();
switch(ch2)
{
case '1': books_tabular(); break;
case '2':
student_tabular(); break;
case '3':
clrscr(); intromain();
gotoxy(10,8);cout<<"***ENTER THE BOOK NO TO BE SEARCHED:";
gotoxy(55,9);cin>>bookno; booksofchoice(bookno);
break;
case '4':
clrscr(); intromain();
gotoxy(10,8);cout<<"***ENTER THE STUDENT NO TO BE SEARCHED:";
15. gotoxy(55,9);cin>>sno; studentdetailreturnbooks(sno);
break;
case '5': clrscr(); intromain();
gotoxy(10,8);cout<<"***ENTER THE STUDENT NO TO BE SEARCHED:";
gotoxy(55,9);cin>>sno; studentdetailbooks(sno);
break;
case '6': clrscr(); intromain();gotoxy(5,6);
cout<<"======================books issued===========================";
gotoxy(5,7);cout<<"1- only limits with bookno 2- book no with student info[Books issued]:";
gotoxy(5,8);cout<<"Enter the choice:";
gotoxy(5,9);cin>>ch3;
switch(ch3)
{
case 1: displaybookslimits(); break;
case 2: displaybookslimitswithstud(); break;
case '7': transaction(); break;
default: cout<<"a"; admin_menu();
} }
//*****************student informations **************************
void write_student()
{
fstream fp;
student st;
fp.open("student.dat",ios::out|ios::app);
clrscr(); intromain();
int rnn=getrollno();
if(rnn>100)
{ rnn=1; }
st.studentaddrecord(rnn);
fp.write((char*)&st,sizeof(student));
fp.close();
gotoxy(10,20); cout<<"***************STUDENTS RECORD SAVED******************* ";
cin.ignore(); getch();
}
//********************check the Student roll number already given or not******
int getrollno()
{
ifstream objiff;
student st;
int count=0,count2=0;
objiff.open("student.dat",ios::binary);
objiff.seekg(0,ios::beg);
if(!objiff)
{ cout<<"File could not be open !! Press any Key...";
count=1;getch();
}else{while(objiff.read((char *) &st, sizeof(student)))
{ count2++;}
count=count2;count++;
}objiff.close();return count;}
//******************modify the record*****************************
void modify_student_record(int n)
{
student st,temp;
char tmpfnm[50],tmplnm[50],tmpclass[15],tmpsec[10];
ifstream inFile;
int fpos=-1;inFile.open("student.dat",ios::binary);
if(!inFile)
{ cout<<"File could not be open !! Press any Key...";
getch(); }
int flag=0;
while(inFile.read((char *) &st, sizeof(student)))
{ if(st.getrno()==n)
{ clrscr(); intromain(); st.showdatamulti(); flag=1;
}
16. }
inFile.close();
if(flag==0)
cout<<"nnrecord not exist";
else{
fstream File;
File.open("student.dat",ios::binary|ios::in|ios::out);
if(!File)
{ cout<<"File could not be open !! Press any Key...";
getch(); return;
}
while(File.read((char *) &st, sizeof(student)))
{if(st.getrno()==n)
{ fpos=(int)File.tellg();
break; } }
File.seekp(fpos-sizeof(student),ios::beg);
strcpy(tmpfnm,st.getfname()); strcpy(tmplnm,st.getlname());
strcpy(tmpclass,st.getclass()); strcpy(tmpsec,st.getsec());
gotoxy(1,12); cout<<"************************************************************";
gotoxy(1,13);cout<<"=ENTER NEW VALUES FOR THE RECORDS GIVEN ABOVE==";
temp.modifydata(n,tmpfnm,tmplnm,tmpclass,tmpsec);
File.write((char *) &temp, sizeof(student)); File.close();
}}
//****************************STUDENTS DETAILS TABULAR FORM ***************************
void display_allstud_tabularform()
{clrscr();
intromain();
gotoxy(1,5);cout<<" **********************STUDENT'S DETAILS***************************";
gotoxy(1,6);cout<<"================================================================";
gotoxy(1,7);cout<<"NO."<<setw(18)<<"FIRST NAME"<<"-"<<"LAST NAME" <<setw(20) <<"CLASS" <<setw(15)
<<"SECTION";
gotoxy(1,8);cout<<"===========================================================";
}
//****************************BOOKS DETAILS TABULAR FORM ***************************
void display_allbooks_tabularform()
{clrscr();
intromain();gotoxy(1,5);
cout<<" **********************BOOK'S DETAILS***************************";
gotoxy(1,6);cout<<"====================================================";
gotoxy(1,7);cout<<"NO."<<setw(15)<<"BOOK NAME"<<"--"<<"PUBLISHER"<<setw(20)<<"AUTHOR" <<setw(10)
<<"PRICE"<<setw(10)<<"QUANT.";
gotoxy(1,8);cout<<"=====================================================";
}//******************************************************************************
// DISPLAY ALL THE STUDENTS TABULAR FORM
//******************************************************************************
void student_tabular()
{ int r=0,col=10;
char ss[15];
student s1;
ifstream inFile;
inFile.open("student.dat",ios::binary);
if(!inFile)
{ cout<<"File could not be open !! Press any Key..."; getch(); return;
}clrscr();
intromain();gotoxy(10,8);cout<<"***ENTER THE CLASS [ I ,II .....XII]:";
gotoxy(55,9); cin>>ss; display_allstud_tabularform();
while(inFile.read((char *) &s1, sizeof(s1)))
{ if(r<=12) { r++;
if(strcmp(ss,s1.getclass())==0)
{ s1.showallstud(col);
col++;
} }else { gotoxy(20,30); cout<<"--------------press any key------------------------";
getch(); clrscr(); display_allstud_tabularform(); col=10; r=0; }}
inFile.close(); getch();
17. }// DISPLAY ALL THE BOOKS TABULAR FORM
//******************************************************************************
void books_tabular()
{
int r=0,col=10,choice=0,tqty=0;
char ss[15];float plow=0.00;float phig=0.00;books b1;
ifstream inFile; inFile.open("books.dat",ios::binary);
if(!inFile)
{ cout<<"File could not be open !! Press any Key..."; getch(); return;
}clrscr();
intromain(); gotoxy(5,8); cout<<"***ENTER THE CHOICE:";
gotoxy(5,9); cout<<" 1- ALL BOOKS 2- PUBLISHER WISE 3- AUTHOR WISE ";
gotoxy(5,10); cout<<" 4- PRICE 5- QUANTITY "; gotoxy(10,11); cin>>choice;
switch(choice) { case 1:
//***********************all books*****************************
display_allbooks_tabularform();
while(inFile.read((char *) &b1, sizeof(b1)))
{
if(r<=12) { r++;
b1.showallbooks(col); col++; }else {
gotoxy(20,30); cout<<"--------------press any key------------------------";
getch(); clrscr(); display_allbooks_tabularform(); col=10; r=0;
} } break;
case 2:
//***********************Publisher wise books*****************************
gotoxy(10,13); cout<<"Enter the publisher name";
gotoxy(10,14); cin>>ss;
display_allbooks_tabularform();
while(inFile.read((char *) &b1, sizeof(b1)))
{
if(r<=12)
{ r++;
if(strcmp(ss,b1.getpub())==0)
{ b1.showallbooks(col); col++; } }else {
gotoxy(20,30); cout<<"--------------press any key------------------------";
getch(); clrscr(); display_allbooks_tabularform(); col=10; r=0;
} } break;
//***********************Publisher wise books*****************************
case 3:
//***********************Author wise books*****************************
gotoxy(10,13);cout<<"Enter the Author name";
gotoxy(10,14);cin>>ss; display_allbooks_tabularform();
while(inFile.read((char *) &b1, sizeof(b1)))
{ if(r<=12) { r++;
if(strcmp(ss,b1.getauthor())==0)
{ b1.showallbooks(col); col++; }
}else { gotoxy(20,30); cout<<"--------------press any key------------------------";
getch(); clrscr(); display_allbooks_tabularform(); col=10; r=0;
}} break;
case 4:
//***********************price wise books*****************************
gotoxy(10,13);
cout<<"Enter the price between [lowest and highest]";
gotoxy(10,14); cin>>plow>>phig; display_allbooks_tabularform();
while(inFile.read((char *) &b1, sizeof(b1)))
{ if(r<=12) { r++;
if(b1.getprice()>=plow && b1.getprice()<=phig)
{ b1.showallbooks(col);
col++; } }else {
gotoxy(20,30); cout<<"--------------press any key------------------------";
getch(); clrscr(); display_allbooks_tabularform(); col=10; r=0;
} } break;
case 5:
//***********************quantity wise books*****************************
18. gotoxy(10,13);cout<<"Enter the quantity:";
gotoxy(10,14);cin>>tqty; display_allbooks_tabularform();
while(inFile.read((char *) &b1, sizeof(b1)))
{ if(r<=12) { r++;
if(b1.getqty()==tqty)
{ b1.showallbooks(col); col++; }
}else { gotoxy(20,30); cout<<"--------------press any key------------------------";
getch(); clrscr(); display_allbooks_tabularform(); col=10; r=0;
}} break;
//***********************quantity wise books*****************************
} inFile.close(); getch();
}
//**************************student deletion***********************************
void delete_student_record(int n)
{
student st;
ifstream inFile;
inFile.open("student.dat",ios::binary);
if(!inFile)
{
cout<<"File could not be open !! Press any Key...";
getch(); return;
}
int flag=0;
while(inFile.read((char *) &st, sizeof(student)))
{ if(st.getrno()==n) { clrscr(); intromain(); st.showdatamulti(); flag=1; }
}
inFile.close();
char ch; if(flag==0)
cout<<"nnrecord not exist";
else{
gotoxy(1,15);cout<<"***************************************************************";
gotoxy(5,16);cout<<"=DO YOU WANT TO DELETE THE RECORDS GIVEN ABOVE[YES(Y)ORNO(N)]==";
gotoxy(2,17);cin>>ch;
if (toupper(ch)=='Y')
{ ofstream outFile;
outFile.open("Temp1.dat",ios::binary);
ifstream objiff("student.dat",ios::binary);
objiff.seekg(0,ios::beg);
while(objiff.read((char *) &st, sizeof(student)))
{ if(st.getrno()!=n)
{ outFile.write((char *) &st, sizeof(student));
}}
outFile.close(); objiff.close();
remove("student.dat"); rename("Temp2.dat","student.dat");
gotoxy(30,20); cout<<"----------------------------Record Deleted----------------------------------";
}}getch();
}
void write_books()
{
fstream fp;
books bk;
fp.open("books.dat",ios::out|ios::app);
bookslimit bklimit;
ofstream objoff("blimit.dat",ios::binary|ios::app);
clrscr();
intromain(); int rnn1=getbookno();
if(rnn1>100)
{ rnn1=1; }
bk.bookaddrecord(rnn1);
fp.write((char*)&bk,sizeof(books));
bklimit.blno=rnn1;
bklimit.bookno=rnn1;
bklimit.limit=bk.getqty();
19. objoff.write((char*)&bklimit,sizeof(bklimit));
objoff.close(); fp.close();
gotoxy(10,20); cout<<"***************BOOKS RECORD SAVED******************* ";
cin.ignore(); getch();
}
//********************check the book number already given or not******
int getbookno()
{
ifstream objiff;
books bk;
int count=0,count2=0;
objiff.open("books.dat",ios::binary);
objiff.seekg(0,ios::beg);
if(!objiff)
{ cout<<"File could not be open !! Press any Key...";
count=1;getch();
}else{
//**************temporary hiding these lines
while(objiff.read((char *) &bk, sizeof(books)))
{ count2++; }
count=count2;count++;
}objiff.close();
return count;}
//******************modify the record*****************************
void modify_books_record(int n)
{
books bk,temp;
fstream objf("blimit.dat",ios::binary|ios::in|ios::out);
bookslimit bkslimit;
char tmpbknm[25],tmppubnm[25],tmpauth[15];
float tmpprice=0.00;
int tmpqty=0;
ifstream inFile;
int fpos=-1;
inFile.open("books.dat",ios::binary);
if(!inFile)
{ cout<<"File could not be open !! Press any Key...";
getch();
}int flag=0;
while(inFile.read((char *) &bk, sizeof(books)))
{if(bk.getbkno()==n)
{ clrscr(); intromain(); bk.showdatamulti_bk();
flag=1;
}
}
inFile.close();
if(flag==0)
cout<<"nnrecord not exist";
else
{fstream File;
File.open("books.dat",ios::binary|ios::in|ios::out);
if(!File)
{ cout<<"File could not be open !! Press any Key...";
getch(); return;
}
while(File.read((char *) &bk, sizeof(books)))
{if(bk.getbkno()==n)
{ fpos=(int)File.tellg();
break;
}
}
File.seekp(fpos-sizeof(books),ios::beg);
strcpy(tmpbknm,bk.getbknm()); strcpy(tmppubnm,bk.getpub());
strcpy(tmpauth,bk.getauthor()); tmpprice=bk.getprice();
20. int q1=bk.getqty(); tmpqty+=q1;
gotoxy(1,12); cout<<"*************************************************************";
gotoxy(1,13); cout<<"ENTER NEW VALUES FOR THE RECORDS GIVEN ABOVE=========";
temp.modifydatabooks(n,tmpbknm,tmppubnm,tmpauth,tmpprice,tmpqty);
File.write((char *) &temp, sizeof(books));
int poslimit=getposlimit(n); objf.seekp(poslimit-sizeof(bkslimit));
objf.read((char*)&bkslimit,sizeof(bkslimit)); bkslimit.limit=bkslimit.limit+q1;
objf.seekp(poslimit-sizeof(bkslimit)); objf.write((char*)&bkslimit,sizeof(bkslimit));
objf.close(); File.close();
}}
//******************search for position of book in a file bookslimit.dat
int getposlimit(int n)
{
int p=-1;
ifstream objiff("blimit.dat",ios::binary);
bookslimit bkl;
if(!objiff)
{ cout<<"File could not be open !! Press any Key...";
getch();
}
while(objiff.read((char *) &bkl, sizeof(bkl)))
{if(bkl.bookno==n)
{ p=(int)objiff.tellg();
break;
}
}
return p;
}
void delete_books_record(int n)
{
books bk;
ifstream inFile;
inFile.open("books.dat",ios::binary);
if(!inFile)
{ cout<<"File could not be open !! Press any Key...";
getch(); return;
}
int flag=0;
while(inFile.read((char *) &bk, sizeof(books)))
{if(bk.getbkno()==n)
{ clrscr(); intromain();
bk.showdatamulti_bk(); flag=1;
}
}
inFile.close();
char ch;
if(flag==0)
cout<<"nnrecord not exist";
else
{gotoxy(1,15);
cout<<"*****************************************************************************";
gotoxy(5,16);cout<<"=DO YOU WANT TO DELETE THE RECORDS GIVEN ABOVE[YES(Y) OR NO (N)]=";
gotoxy(2,17); cin>>ch;
if (toupper(ch)=='Y')
{
ofstream outFile;
outFile.open("Temp1.dat",ios::binary);
ifstream objiff("books.dat",ios::binary);
objiff.seekg(0,ios::beg);
while(objiff.read((char *) &bk, sizeof(books)))
{ if(bk.getbkno()!=n)
{ outFile.write((char *) &bk, sizeof(books));
}}
outFile.close(); objiff.close();
21. remove("books.dat"); rename("Temp2.dat","books.dat");
ifstream objiff2("blimit.dat",ios::binary); ofstream objoff("limitemp.dat",ios::binary);
bookslimit bklimit;
while(objiff2.read((char*)&bklimit,sizeof(bklimit)))
{ if(bklimit.bookno!=n)
{objoff.write((char*)&bklimit,sizeof(bklimit));}
}
objoff.close(); objiff2.close();
remove("blimit.dat");rename("limitemp.dat","blimit.dat");
gotoxy(30,20);cout<<"----------------------------Record Deleted----------------------------------";
} }
getch();
}
void write_transcation()
{ fstream fp;
fp.open("trans.dat",ios::binary|ios::in|ios::out|ios::app);
trans tr;
fstream fplimit("blimit.dat",ios::binary|ios::in|ios::out);
bookslimit bkslimit;
int col=0,flagstud=-1,flagtrans=-1,ch,tmplimit=0,stno=0;
char tmpf[15],tmpl[15],ch2;
books bk; fstream bkobj;
student s1; int tmpstudno=0,bookno=0;
ifstream inFile;
inFile.open("student.dat",ios::binary);
clrscr(); intromain();
int rnn1=gettransno();
if(rnn1>100)
{ rnn1=1;}
clrscr(); intromain();
gotoxy(5,6); cout<<"=========TRANSACTIONS===========================";
gotoxy(5,7); cout<<"Enter the Student 1- First name and Last name 2- student no:";
gotoxy(5,8); cin>>ch;
switch(ch)
{ case 1:
clrscr(); intromain();
gotoxy(5,6); cout<<"==========TRANSACTIONS===========================";
gotoxy(5,7); cout<<"Enter First name and Last name:";
gotoxy(5,8); cin>>tmpf;
cin>>tmpl; if(!inFile)
{
cout<<"File could not be open !! Press any Key...";
getch();
} clrscr(); intromain();
gotoxy(5,6);
while(inFile.read((char *) &s1, sizeof(s1)))
{
if(strcmp(tmpf,s1.getfname())==0 && strcmp(tmpl,s1.getlname())==0)
{
tmpstudno=s1.getstudno();
flagstud=1; //flag value is to stop when the record found
break;
} }
if(flagstud==1)
{cout<<"=========================TRANSACTIONS===========================";
//*************************** display_allstud_tabularform()*****************************
gotoxy(1,7); cout<<" **********************STUDENT'S DETAILS***************************";
gotoxy(1,8);cout<<"=================================================================";
gotoxy(1,9); cout<<"NO."<<setw(18)<<"FIRST NAME"<<"-"<<"LAST NAME"<<setw(20)<<"CLASS" <<setw(15)
<<"SECTION";
gotoxy(1,10);cout<<"================================================================";
col=11; s1.showallstud(col);
getch(); if(!fp)
{ cout<<"File could not be open !! Press any Key...";
22. getch(); return;
} //comp
//*********************check for how many books issued or not[limits]******************************
col=13; int check=getresult(tmpstudno);
if(check==2)
{ gotoxy(10,12); cout<<"nAlready issued the books upto 3"; }
else if(check==0 || check==1)
{ gotoxy(5,col); cout<<"Enter the book no:";
col++; gotoxy(5,col); cin>>bookno;
//***********************search book*******************************
bkobj.open("books.dat",ios::binary|ios::in|ios::out);
int bkflag=-1;
while(bkobj.read((char *) &bk, sizeof(books)))
{
if(bk.getbkno()==bookno) //&& (bk.getqty()>0 && bk.getqty()<=4))
{ bkflag=1; break; }
}
//********************check for the books available or not from bookslimit file***************
if(bkflag==1)
{
while(fplimit.read((char *) &bkslimit, sizeof(bkslimit)))
{ if(bkslimit.bookno==bookno) //&& (bk.getqty()>0 && bk.getqty()<=4))
{
bkflag=2;break;
} } }
if(bkflag==2)
{ if(bkslimit.limit>0)
{ tmplimit=bkslimit.limit;
bkflag=3;
}else {
bkflag=-3;
} }
if(bkflag==-3)
{clrscr();
gotoxy(10,12);cout<<"OUT OF STOCK";
}
if(bkflag==3)
{ col++; gotoxy(5,col);
cout<<"============================TRANSACTIONS===========================";
col++; gotoxy(1,col);
cout<<"BOOK NO"<<setw(10)<<"BOOKNAME"<<"--"<<"PUBLISH." <<setw(20)<<"AUTHOR" <<setw(10)
<<"QTY";
col++; bk.showonlybooks(col,tmplimit);
col++;gotoxy(5,col);cout<<"Want to issue this book";
col++;gotoxy(5,col);cin>>ch2;
if(ch2=='y')
{ clrscr(); intromain();
col=10; dateofissued dd1,dd2;
col++; gotoxy(5,col); cout<<"Enter the date of issue[dd - mm - yy]";
col++; gotoxy(5,col); cin>>dd1.dd>>dd1.mm>>dd1.yy;
col++; gotoxy(5,col); cout<<"Enter the date of return[dd - mm - yy]";
col++; gotoxy(5,col); cin>>dd2.dd>>dd2.mm>>dd2.yy;
tr.settrans(rnn1,tmpstudno,bookno,dd1,dd2,'Y');
fp.write((char*)&tr,sizeof(tr));
int poslimit2=getposlimit(bookno); fplimit.seekp(poslimit2-sizeof(bkslimit));
fplimit.read((char*)&bkslimit,sizeof(bkslimit)); bkslimit.limit=bkslimit.limit-1;
fplimit.seekp(poslimit2-sizeof(bkslimit)); fplimit.write((char*)&bkslimit,sizeof(bkslimit));
flagtrans=1; }}} }
break;
case 2:
clrscr(); intromain();
gotoxy(5,6); cout<<"=============TRANSACTIONS===========================";
gotoxy(5,7); cout<<"Enter Student no:";
gotoxy(5,8); cin>>stno;
23. if(!inFile)
{cout<<"File could not be open !! Press any Key...";
getch(); }
clrscr(); intromain();
gotoxy(5,6); while(inFile.read((char *) &s1, sizeof(s1)))
{
if(stno==s1.getstudno())
{
tmpstudno=s1.getstudno();
flagstud=1; //flag value is to stop when the record found
break;
} }
if(flagstud==1)
{cout<<"============================TRANSACTIONS===========================";
gotoxy(1,7); cout<<" **********************STUDENT'S DETAILS***************************";
gotoxy(1,8);cout<<"=================================================================";
gotoxy(1,9);cout<<"NO."<<setw(18)<<"FIRST NAME"<<"-"<<"LAST NAME"<<setw(20)<<"CLASS"<<setw(15)
<<"SECTION";
gotoxy(1,10);cout<<"================================================================";
col=11; s1.showallstud(col);
getch();if(!fp)
{ cout<<"File could not be open !! Press any Key...";
getch(); return;
} //comp
col=13; int check=getresult(tmpstudno);
if(check==2)
{ gotoxy(10,12);cout<<"nAlready issued the books upto 3";
}
else if(check==0 || check==1)
{ gotoxy(5,col);
cout<<"Enter the book no:"; col++;
gotoxy(5,col); cin>>bookno;
bkobj.open("books.dat",ios::binary|ios::in|ios::out);
int bkflag=-1;
while(bkobj.read((char *) &bk, sizeof(books)))
{ if(bk.getbkno()==bookno) //&& (bk.getqty()>0 && bk.getqty()<=4))
{bkflag=1;
break;
} }
//********************check for the books available or not from bookslimit file***************
if(bkflag==1)
{ while(fplimit.read((char *) &bkslimit, sizeof(bkslimit)))
{ if(bkslimit.bookno==bookno) //&& (bk.getqty()>0 && bk.getqty()<=4))
{bkflag=2;
break; } } }
if(bkflag==2)
{ if(bkslimit.limit>0)
{ tmplimit=bkslimit.limit; bkflag=3;
}else { bkflag=-3; } }
//************message that book is out of stock*********************8
if(bkflag==-3)
{ clrscr();
gotoxy(10,12);cout<<"OUT OF STOCK";
}
if(bkflag==3)
{ col++; gotoxy(5,col); cout<<"==================TRANSACTIONS=============";
col++; gotoxy(1,col); cout<<"BOOK
NO"<<setw(10)<<"BOOKNAME"<<"--"<<"PUBLISH."<<setw(20)<<"AUTHOR"<<setw(10)<<"QTY";
col++; bk.showonlybooks(col,tmplimit);
col++; gotoxy(5,col); cout<<"Want to issue this book";
col++; gotoxy(5,col); cin>>ch2;
if(ch2=='y')
{ clrscr(); intromain(); col=10; dateofissued dd1,dd2;
col++; gotoxy(5,col); cout<<"Enter the date of issue[dd - mm - yy]";
24. col++; gotoxy(5,col); cin>>dd1.dd; gotoxy(15,col); cin>>dd1.mm;
gotoxy(25,col); cin>>dd1.yy; col++; gotoxy(5,col); cout<<"Enter the date of return[dd - mm - yy]";
col++; gotoxy(5,col); cin>>dd2.dd; gotoxy(15,col); cin>>dd2.mm;
gotoxy(25,col); cin>>dd2.yy; tr.settrans(rnn1,tmpstudno,bookno,dd1,dd2,'Y');
fp.write((char*)&tr,sizeof(tr)); int poslimit2=getposlimit(bookno);
fplimit.seekp(poslimit2-sizeof(bkslimit)); fplimit.read((char*)&bkslimit,sizeof(bkslimit));
bkslimit.limit=bkslimit.limit-1; fplimit.seekp(poslimit2-sizeof(bkslimit));
fplimit.write((char*)&bkslimit,sizeof(bkslimit)); flagtrans=1;
} } } }
break; //****************************search by stud no
} //***********switch closed****************
//*****************************************************************************
if(flagtrans==1)
{clrscr();gotoxy(8,30); cout<<"***************transcation saved******************************";
getch(); }else{
clrscr(); gotoxy(8,30);
cout<<"***************transcation not saved******************************";
getch();
}
fplimit.close(); inFile.close();
fplimit.close(); fp.close();
bkobj.close();
//*****************************************************************************************
}
//********************check the trans number already given or not******
int gettransno()
{ ifstream objiff;
trans tr;
int count=0,count2=0;
objiff.open("trans.dat",ios::binary);
objiff.seekg(0,ios::beg);
if(!objiff)
{ cout<<"File could not be open !! Press any Key...";
count=1;getch();
}else{
//**************temporary hiding these lines
while(objiff.read((char *) &tr, sizeof(trans)))
{ count2++; }
count=count2;count++;
}
objiff.close();return count;
}
int getresult(int stno)
{ ifstream objiff;
trans tr;
int count=-1,count2=0;
objiff.open("trans.dat",ios::binary);
objiff.seekg(0,ios::beg);
if(!objiff)
{ cout<<"File could not be open !! Press any Key...";
getch();
}else{
//**************temporary hiding these lines
while(objiff.read((char *) &tr, sizeof(trans)))
{ if(tr.getstudno()==stno && tr.getstatus()=='Y')
count2++;
} }
if(count2>=4)
{ count=2;
}else if(count2==0)
{ count=0;
}else
{count=1;
25. }
objiff.close();
return count;
}
//*****************display books one record at a time********************
void displaybooks(int bkno,int c)
{ books bk;
ifstream inFile;
inFile.open("books.dat",ios::binary);
if(!inFile)
{ cout<<"File could not be open !! Press any Key...";
getch(); return;
}else{
while(inFile.read((char *) &bk, sizeof(books)))
{ if(bk.getbkno()==bkno)
{ bk.showallbooks(c);
break;
}} }
inFile.close();
}
//***********************books limit list
void displaybookslimits()
{ ifstream inFile;
bookslimit bkslimit;
inFile.open("blimit.dat",ios::binary);
if(!inFile)
{ cout<<"File could not be open !! Press any Key...";
getch();
}
clrscr(); intromain();
gotoxy(5,5); int c=6;
cout<<"BNO."<<setw(10)<<"BOOKNO"<<setw(10)<<"BOOKS ISSUED";
while(inFile.read((char *) &bkslimit, sizeof(bkslimit)))
{ gotoxy(5,c); cout<<bkslimit.blno<<setw(10)<<bkslimit.bookno<<setw(10)<<bkslimit.limit;
c++; }
inFile.close(); getch();
}
void displaybookslimitswithstud()
{ student s1;
ifstream stfile;
ifstream objiff; trans tr;
ifstream inFile; bookslimit bkslimit;
inFile.open("blimit.dat",ios::binary);
books bk; ifstream bkfile;
int tmpbkno=0,tmpstdno=0;
if(!inFile)
{ cout<<"File could not be open !! Press any Key...";
getch(); return;
} clrscr();
intromain();
int c=7;
while(inFile.read((char *) &bkslimit, sizeof(bkslimit)))
{ tmpbkno=bkslimit.bookno;
bkfile.open("books.dat",ios::binary);
while(bkfile.read((char *) &bk, sizeof(books)))
{
if(bk.getbkno()==tmpbkno)
{ break;}
}
bkfile.close();
clrscr();intromain();gotoxy(5,7);
cout<<"=======================================================================";
gotoxy(5,8);cout<<" BOOKS DETAILS";
gotoxy(5,9);cout<<"================================================================";
26. gotoxy(5,10);cout<<"BOOK NO: "<<bkslimit.bookno<<setw(40)<<"BOOK NAME: "<<bk.getbknm();
gotoxy(5,11);cout<<"BOOK ISSUED :"<<(bk.getqty()-bkslimit.limit)<<setw(35)<<"BOOK TOTAL: "<<bk.getqty();
gotoxy(5,12);cout<<"-----------------------------------------------------------------------";
gotoxy(5,13);cout<<"==================================================================";
gotoxy(5,14);cout<<" STUDENT'S DETAILS";
gotoxy(5,15);cout<<"==================================================================";
gotoxy(10,16);cout<<"STUDENT NAME"<<setw(20)<<"CLASS";
gotoxy(5,17);cout<<"-----------------------------------------------------------------------";
int flag=-1; c=18;
objiff.open("trans.dat",ios::binary);
while(objiff.read((char *) &tr, sizeof(trans)))
{ if(tr.getbookno()==tmpbkno && tr.getstatus()=='Y')
{
tmpstdno=tr.getstudno(); flag=1;}
if(flag==1)
{
gotoxy(20,20);
stfile.open("student.dat",ios::binary);
while(stfile.read((char *) &s1, sizeof(s1)))
{ if(tmpstdno==s1.getstudno())
{break; }
}
gotoxy(5,c);cout<<s1.getfname()<<" "<<s1.getlname()<<setw(20)<<s1.getclass();
c++;gotoxy(5,c); cout<<"-----------------------------------------------------------------------";
c++; flag=-1; stfile.close();
} }
objiff.close();gotoxy(5,c);
cout<<"***********************Press Key To Continue*****************************";
}inFile.close(); getch();
}
void transaction()
{
ifstream inFile;
trans tr;
inFile.open("trans.dat",ios::binary);
if(!inFile)
{cout<<"File could not be open !! Press any Key...";
getch();
} else {
clrscr(); intromain();
gotoxy(1,7); int c=8;
cout<<"TRANSNO"<<setw(10)<<"STUDNO"<<setw(10)<<"BOOKNO"<<setw(20)<<"DATE OF ISSUE"
<<setw(20)<<"DATE OF RETURN"<<setw(10)<<"STATUS";
while(inFile.read((char*) &tr, sizeof(trans)))
{ tr.showalltrans(c); c++;
}}
inFile.close();getch();
}
void return_transaction(int trno)
{ finemoney fine1;
ofstream objfine("fine.dat",ios::binary|ios::app);
books bk; ifstream bkobj;
bkobj.open("books.dat",ios::binary);
student s1; ifstream inFile;
inFile.open("student.dat",ios::binary);
fstream fp; fp.open("trans.dat",ios::binary|ios::in|ios::out);
trans tr; fstream fplimit("blimit.dat",ios::binary|ios::in|ios::out);
bookslimit bkslimit; dateofissued tmpdate,returndate;
int c=8,transflag=-1,tmpstno=0,tmpbkno=0,fineflag=-1,tranpos=0;
if(!fp)
{ cout<<"File could not be open !! Press any Key...";
getch(); return;
}clrscr();intromain();
27. gotoxy(1,7);cout<<"TRANSNO"<<setw(10)<<"STUDNO"<<setw(10)<<"BOOKNO"<<setw(20)<<"DATE OF ISSUE"
<<setw(20)<<"DATE OF RETURN";
while(fp.read((char *) &tr, sizeof(trans)))
{ if(tr.gettno()==trno && tr.getstatus()=='Y')
{ transflag=1;
tranpos=(int)fp.tellg();
break;
}}
if(transflag==1)
{ tr.showalltrans(c); tmpstno=tr.getstudno();
tmpbkno=tr.getbookno(); returndate=tr.getdate();
c++; gotoxy(1,c); cout<<"==============================================================";
c++; gotoxy(1,c); cout<<"=============STUDENT'S DETAIL================================";
c++; gotoxy(1,c); c++;
cout<<"NO."<<setw(18)<<"FIRST NAME"<<"-"<<"LAST NAME"<<setw(20)<<"CLASS"<<setw(15)<<"SECTION";
while(inFile.read((char *) &s1, sizeof(s1)))
{ if(tmpstno==s1.getstudno())
{ gotoxy(1,c);
cout<<"==================================================================";
c++; s1.showallstud(c); c++; gotoxy(1,c);
cout<<"==================================================================";
break; }}
c++; gotoxy(1,c);
cout<<"======================================================================";
c++; gotoxy(1,c);
cout<<"===================BOOK'S DETAIL================================";
c++; gotoxy(1,c); c++;
cout<<"BOOK NO"<<setw(10)<<"BOOKNAME"<<"--"<<"PUBLISH."<<setw(20)<<"AUTHOR"<<setw(10)<<"QTY";
c++;
while(bkobj.read((char *) &bk, sizeof(books)))
{
if(bk.getbkno()==tmpbkno)
{gotoxy(1,c)cout<<"=======================================================================";
c++; bk.showallbooks(c); c++;
gotoxy(1,c);cout<<"=====================================================================";
break; }}
c++; gotoxy(1,c); cout<<"Please enter the returning date of book[dd-mm-yy]";
c++; gotoxy(1,c); cin>>tmpdate.dd;gotoxy(10,c); cin>>tmpdate.mm;gotoxy(20,c);cin>>tmpdate.yy;
int totalmonth=0,totaldays=0,totalfine=0;
if(returndate.yy==tmpdate.yy || returndate.yy!=tmpdate.yy)
{ if(returndate.mm!=tmpdate.mm)
{ totalmonth=tmpdate.mm-returndate.mm;
fineflag=1;
} if(returndate.dd!=tmpdate.dd)
{
totaldays=tmpdate.dd-returndate.dd;
fineflag=1;
}
}else{
c++; gotoxy(10,c); cout<<"you return the book and contact librarian for fine ";
c++; gotoxy(10,c); cin>>totalfine;
fineflag=1;}
if(fineflag==1)
{ int fnn1=getfineno();
if(fnn1>100)
{ fnn1=1; }
totaldays=totaldays+(totalmonth*30);totalfine=totaldays*2;
fine1.fno=fnn1;fine1.stdno=tmpstno;
fine1.total=totalfine;objfine.write((char*)&fine1,sizeof(fine1));
c++; gotoxy(1,c); cout<<"************Total FINE = "<<totalfine;
c++; gotoxy(1,c); cout<<"**********THANKS FOR RETURNING BOOK**********************";
}else{
c++; gotoxy(1,c); cout<<"*********THANKS FOR RETURNING BOOK**********************";
} tr.setstatus('N'); fp.seekp(tranpos-sizeof(trans),ios::beg);
28. fp.write((char *) &tr, sizeof(trans));
poslimit2=getposlimit(tmpbkno); fplimit.seekp(poslimit2-sizeof(bkslimit));
fplimit.read((char*)&bkslimit,sizeof(bkslimit)); bkslimit.limit=bkslimit.limit+1;
fplimit.seekp(poslimit2-sizeof(bkslimit)); fplimit.write((char*)&bkslimit,sizeof(bkslimit));
}else{ gotoxy(10,10); cout<<"NO SUCH TRANSCATIONS !!!!!!!!!!!!!!!!!!"; }
objfine.close(); inFile.close(); bkobj.close(); objfine.close(); fp.close(); fplimit.close();
}//**************************return trans
int getfineno()
{ ifstream objiff;
finemoney fine1;
int count=0,count2=0;
objiff.open("fine.dat",ios::binary);
objiff.seekg(0,ios::beg);
if(!objiff)
{cout<<"File could not be open !! Press any Key...";
count=1;getch();
}else{
while(objiff.read((char *) &fine1, sizeof(fine1)))
{ count2++;}
count=count2;count++;
}objiff.close();
return count;
}
void booksofchoice(int bkno1)
{ ifstream blim;
bookslimit bkslimit;
blim.open("blimit.dat",ios::binary);
books b1;
ifstream inFile;
inFile.open("books.dat",ios::binary);
int f=-1;
if(!inFile)
{ cout<<"File could not be open !! Press any Key...";
getch(); return;
}
while(inFile.read((char *) &b1, sizeof(books)))
{ if(b1.getbkno()==bkno1)
{f=1; break; }
}if(f==1){ clrscr(); intromain();
b1.showdatamulti_bk();
gotoxy(10,13); cout<<"=============================================================";
gotoxy(20,14); cout<<"*********NO OF BOOKS STILL AVAILABLE**************";
gotoxy(10,15);cout<<"=========================================================";
gotoxy(20,16);cout<<setw(10)<<"-----------------"<<setw(10)<<"BOOKS NOT ISSUED"<<"-----------------";
while(blim.read((char *) &bkslimit, sizeof(bkslimit)))
{
if(bkslimit.bookno==bkno1)
{gotoxy(20,17); cout<<setw(10)<<"-----------------"<<setw(10)<<bkslimit.limit<<"-----------------";
break;}}
}else{ gotoxy(10,20); cout<<"***************no such book********************";
}inFile.close();
getch();
}
void studentdetailbooks(int stno)
{ books bk;
ifstream bkfile;
ifstream objiff;
trans tr; student s1; ifstream inFile;
inFile.open("student.dat",ios::binary);
int c=7; clrscr();
intromain(); gotoxy(1,c);cout<<"========================================================";
c++; gotoxy(1,c); cout<<"============STUDENT'S DETAIL================================";
c++; gotoxy(1,c);
35. If choice is “yes”
*******************BOOKS RETURN TRANSCATION**********************
*******************REPORTS**********************
36. *******************ALL BOOKS DETAILS**********************
If choice is 1 (all books)
*******************ALL STUDENTS DETAILS**********************
***SEARCH & DISPLAY BOOKS DETAILS WITH TOTAL BOOKS ISSUED DETAILS***
*******************STUDENTS DETAILS WITH NO OF BOOKS WITH
FINE***************
37. *************DISPLAY STUDENT DETAILS WITH NO OF BOOKS ISSUED*********
*******************BOOKS WITH LIMITS & STUDENT DETAILS
**********************
*******************ALL THE TRANSCATIONS**********************
38. REQUIREMENTS
HARDWARE REQUIRED
• Printer, to print the required documents of the project
• Compact Drive
• Processor : intel
• Ram : 512 MB or more than 512MB
• Harddisk : 80 GB or more than 80GB.
SOFTWARE REQUIRED
• Operating system : Windows XP
• Turbo C++, for execution of program and Ms word, for
presentation of output.
39. ADVANTAGES
• Students do not have to wait in long queues.
• Librarian does not need to worry about books.
• This software reduces paper work.
• It is easy to handle students’s record.
• It is easily to handle the books records.
• This software saves the time.
• Information of the students stores permanently.
DISADVANTAGES
• This system suitable for only few small schools.
• Online facility is not available.
40. CONCLUSION
This software is efficient in maintaining customer’s
details and can easily perform operations on customer’s
records. This software also reduces the work load of the
travel agency manager.
In future, this system can launch web site for easy
online registration. In this system there is limitation for
places and vehicles. In future, it can be extended to add
more place and vehicles.
41. SYSTEM DESIGN
Then we began with the design phase of the system. System design is a
solution, a “HOW TO” approach to the creation of a new system. It translates
system requirements into ways by which they can be made operational. It is a
translational from a user oriented document to a document oriented
programmers. For that, it provides the understanding and procedural details
necessary for the implementation. Here we use Flowchart to supplement the
working of the new system. The system thus made should be reliable, durable
and above all should have least possible maintenance costs. It should
overcome all the drawbacks of the Old existing system and most important of
all meet the user requirements.
42. Content diagram of Project/FLOWCHART
MAIN MENU
Report generator Administrator
Display all
Books
Student
Info.
Books
Info.
Transcation
Display all
transactions
Display student
details with no. of
books issued
START
LOGIN PAGE
Add Stud.
Mod. Stud.
Del.Stud.
Add Book.
Mod. Book
Del.Book
Issue Books Trans.
Return Books Trans.
Display all
Students
Search&Display
total books issued
Display student details with
return/not return books with
fine or not
Books with limits and
students to whom book
issued