0% found this document useful (0 votes)
64 views

Computer Project File: XII Library File MAnagement

This document is a project report submitted by Shubham Garg for a school library management system created in C++. The report includes a certificate, acknowledgements, table of contents, working of the program, special features, header files used, data files used and the source code for the system. The system allows users to manage records of students, books and transactions for issuing and returning books in the library.

Uploaded by

Shubham Garg
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

Computer Project File: XII Library File MAnagement

This document is a project report submitted by Shubham Garg for a school library management system created in C++. The report includes a certificate, acknowledgements, table of contents, working of the program, special features, header files used, data files used and the source code for the system. The system allows users to manage records of students, books and transactions for issuing and returning books in the library.

Uploaded by

Shubham Garg
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Project Report On

Library Management System

Supervisor: Mrs. Deepika Sabharwal Senior Teacher, Computers

New Era Public School, Mayapuri New Delhi

Submitted by: SHUBHAM GARG XII-F Roll No.: 36

1|Page

CERTIFICATE
This is to certify that the project report titled Library Management System has been accomplished by Shubham Garg of class XII-F, Roll No. 36, under my guidance.

The report is submitted for partial fulfillment of the award of the All India Senior School Certificate Computer Practical Examination held at New Era Public School affiliated to Central Board of Secondary Education.

Date: 15thJanuary 2014

Mrs. Deepika Sabharwal Senior Teacher, Computers New Era Public School Mayapuri New Delhi

2|Page

ACKNOWLEDGEMENT
I take this opportunity to express my profound sense of gratitude and respect to all those who helped me throughout the duration of this Project. I acknowledge the effort of those who have contributed significantly towards this. This report is a reflection of not only my work, but also the input of many, whose contribution I would like to acknowledge. My sincere and genuine thanks goes to Mrs. Vandana Chawala, principle of New Era Public School, New Delhi for providing me with the all the necessary support which enabled me to accomplish the project successfully. I would like to express my gratitude towards my guide Mrs. Deepika Sabharwal for her supervision, advice, and guidance. Above all and the most needed, they provided me unflinching encouragement and support in various ways, which exceptionally inspired and enriched my growth as a student. Lastly, I would like to acknowledge everybody who, though remain unmentioned, yet have been connected with my project directly or indirectly and entire staff of Science Department for all their understanding and cooperation.

Shubham Garg XII-F 36

3|Page

TABLE OF CONTENTS
Certificate Acknowledgement i ii

1. Introduction 1.1. 1.2. 1.3. 1.4. Working of the program Special Feature Header files used Data files used

5 5 7 8 10

2. System flowchart

11

3. Source Code

12

4. Output

32

4|Page

WORKING OF PROGRAM
This is an automated software system written in C++ programming language for Management of a School Library which can handle records of Students, Books, and Transactions.

Issue of Books
Students can Issue Books from the vast variety of books that the library can offer. The issue of a book takes care of the availability of copies of any certain book.

Return of Books
The Return of Books is as easily possible as is their issue. The Transactions data base takes care of the transactions between the library and the students. Again the availability of copies is updated on the spot!

New Students
Records for new students and visitors of the library can be easily created, deleted, inserted, modified and can be searched on individual basis, using their Roll No. as primary key, or the whole database can be displayed as a whole with the help of dedicated data file.

5|Page

New Books
Records for new books can be easily created, deleted, inserted, modified and can be searched on individual basis, using the Book Id as the primary key, or the whole database can be displayed as a whole with the help of a dedicated data file.

Transactions
Transactions are easily managed due to the allotment of a separate data file for transactions where an issue and return are identified by Transactions. Individual search is possible (by transaction code) and so is the complete display of the database.

6|Page

SPECIAL FEATURES
Library Goes Live!
With this simple to use software the library goes live with immediate changes to the database may it be Students, Books or Transactions.

Self-Generated Report
The software is aware of what people are reading the most and what is being liked. It produces a report which informs the user of the most read book of the library and transaction of the day!

Attractive Graphical Welcome


The library welcomes you warmly with little graphics.

7|Page

HEADER FILES USED


NAME OF THE HEADER FILE FUNCTIONSUSED USE OF THE FUNCTION

(i)clrscr(), (ii)getch(),

Clears the current text window. Reads a single character (without echoing). Moves the cursor to the given position. Clears to end of the line in the text window. Reads a single character (echoes it to the current text window). Selects the new color in the text mode. Selects a new text background colour. Sends formatted output to the text window on the screen. To display blinking characters in text mode.

(iii)gotoxy. conio.h (iv)clreol(),

(v)getche(),

(vi)textcolor(), (vii)textbackground(), (viii)cprintf(),

(ix)blink()

iostream.h

(i)cout, (ii)cin

Sends the output to the screen. Sends input from user to memory.

8|Page

fstream.h

(i)open(), (ii)close(), (iii)read(), (iv)write(), (v)eof(), (vi)seekg()

Opens the file for fstream. Closes the open file. Reads bytes from a file into a buffer. Writes a buffer of data to a file or device. Checks for end-of-file. Checks for end-of-file.

graphics.h

(i) outtextxy()

outtextxy function display text or string at a specified point(x,y) on the screen. settextstyle function is used to change the way in which text appears, using it we can modify the size of text, change direction of text and change the font of text. In Turbo Graphics each color is assigned a number. Total 16 colors are available. Strictly speaking number of available colors depends on current graphics mode and driver.

(ii) settextstyle()

(iii) setcolor()

stdlib.h

(i)atoi(), (ii)atof()

Macro that converts string to integer. Macro that converts string to floating point.

9|Page

string.h

(i)strlen(), (ii)strcpy(), (iii)strcmpi(), (iv)strupr()

Calculates length of the string. Copies string src to dest. Compares without case sensitivity. Converts lowercase to uppercase.

ctype.h stdio.h

(i)toupper() (i)gets()

Translates characters to uppercase. Collects the string of characters.

DATAFILE USED
STUDENTS.DAT BOOKS.DAT TRANS.DAT

10 | P a g e

System Flowchart

11 | P a g e

SOURCE CODE
//*********************************LIBRARY***************************

//***************************BY:- Shubham Garg ********************** //Header files #include<iostream.h> #include<fstream.h> #include<stdio.h> #include<string.h> #include<conio.h> #include<ctype.h> #include<stdlib.h> #include<graphics.h> //******************************************************************** // UNIVERSAL SCOPE ofstreamfout; ifstream fin; charans; intidcheck; //******************************************************************** // PAGE 0 voidgetoption(int&opt) { cout<<"Choose one of these actions:-"<<endl; cout<<endl<<"1. Edit database:-"<<endl; cout<<"2. Transactions:-"<<endl; cout<<"3. Report:-"<<endl; cout<<"4. Exit:-"<<endl; cout<<endl<<"Enter option:- "; cin>>opt; }; //******************************************************************** // PAGE 1 void getoptionpage2(int&opt2) { cout<<"Choose the database to edit:-"<<endl; cout<<endl<<"1. Student:-"<<endl; cout<<"2. Library books:-"<<endl; cout<<"3. <--- Back"<<endl;
12 | P a g e

cout<<endl<<"Enter option:- "; cin>>opt2; }; //******************************************************************** // PAGE 2 void getoptionpage3(int&opt3) { cout<<"Choose one of these actions:-"<<endl; cout<<endl<<"1. Add:-"<<endl; cout<<"2. Modify:-"<<endl; cout<<"3. Delete:-"<<endl; cout<<"4. Insert:-"<<endl; cout<<"5. Display:-"<<endl; cout<<"6. Search:-"<<endl; cout<<"7. <--- Back"<<endl; cout<<endl<<"Enter option:- "; cin>>opt3; }; //******************************************************************** // PAGE 3 void getoptionpage4(int&opt4) { cout<<"Choose one of these actions:-"<<endl; cout<<endl<<"1. Issue a book:-"<<endl; cout<<"2. Return a book:-"<<endl; cout<<"3. Display all transactions:-"<<endl; cout<<"4. Search Transaction:-"<<endl; cout<<"5. <--- Back"<<endl; cout<<endl<<"Enter option:- "; cin>>opt4; }; //******************************************************************** // CLASS OF BOOKS class books { public: intbook_id; charbook_name[20]; charbook_writer[20]; intbook_copies; intbook_issued; inttotalno_issue; voidgetdata() { cout<<"Enter Book ID -"<<endl; cin>>book_id;
13 | P a g e

cout<<"Enter Book Name -"<<endl; gets(book_name); cout<<"Enter Book Writer -"<<endl; gets(book_writer); cout<<"Enter the number of copies -"<<endl; cin>>book_copies; cout<<"Enter the number of copies issued -"<<endl; cin>>book_issued; totalno_issue=0; } void display() { cout<<book_id<<"\t"<<book_name<<"\t"<<book_writer<<"\tCopies"<<book_copies<<"\tIssued-"<<book_issued<<"\tTotal"<<totalno_issue<<endl; } }; //******************************************************************** // CLASS OF STUDENTS class students { public: intstudent_rno; charstudent_name[20]; intstudent_class; voidgetdata() { cout<<"Enter Student no. -"<<endl; cin>>student_rno; cout<<"Enter Student Name -"<<endl; gets(student_name); cout<<"Enter the class of student -"<<endl; cin>>student_class; } void display() { cout<<student_rno<<"\t"<<student_name<<"\tClass-"<<student_class<<endl; } }; //******************************************************************** // CLASS OF TRANSACTIONS class trans { public: chartrans_type; chartrans_code[6]; char date[9];
14 | P a g e

charstudent_name[20]; intstudent_rno; charbook_name[20]; intbook_id; voidgetdata() { cout<<"Please enter transaction code(5 characters):-"<<endl; cin>>trans_code; cout<<"Please enter the date of transaction (dd-mm-yy):-"<<endl; cin>>date; } void display() { cout<<"Transaction code:-"<<trans_code<<endl; cout<<"Transaction type:-"<<trans_type<<endl; cout<<"Transaction date:-"<<date<<endl; cout<<"Student no. and Name:-"<<student_rno<<"\t"<<student_name<<endl; cout<<"Book ID and Name:-"<<book_id<<"\t"<<book_name<<endl<<endl; } }; //******************************************************************** // ADD voidaddb(books obj) //books { ans='Y'; fout.open("books.dat",ios::app); while(toupper(ans)=='Y') { clrscr(); cout<<***** LIBRARY DATABASE --> EDIT --> ADD *****"<<endl<<endl; obj.getdata(); fout.write((char*)&obj,sizeof(books)); cout<<"Do you want to add more? Y/N"<<endl; cin>>ans; } fout.close(); }; void adds(students obj) //students { ans='Y'; fout.open("students.dat",ios::app); while(toupper(ans)=='Y') { clrscr();
15 | P a g e

cout<<"***** LIBRARY DATABASE --> EDIT --> ADD*****"<<endl<<endl; obj.getdata(); fout.write((char*)&obj,sizeof(students)); cout<<"Do you want to add more? Y/N"<<endl; cin>>ans; } fout.close(); }; //******************************************************************** // DISPLAY voiddisplayb(books obj) //books { clrscr(); cout<<"******************** LIBRARY DATABASE --> EDIT --> DISPLAY *********************"<<endl<<endl; fin.open("books.dat"); fin.read((char*)&obj,sizeof(books)); while (fin) { obj.display(); fin.read((char*)&obj,sizeof(books)); } fin.close(); cout<<endl<<"Press a button to return to EDIT page."; getch(); }; void displays(students obj) //students { clrscr(); cout<<"******************** LIBRARY DATABASE --> EDIT --> DISPLAY *********************"<<endl<<endl; fin.open("students.dat"); fin.read((char*)&obj,sizeof(students)); while (fin) { obj.display(); fin.read((char*)&obj,sizeof(students)); } fin.close(); cout<<endl<<"Press a botton to return to EDIT page."; getch(); }; voiddisplayt(trans obj) //transaction
16 | P a g e

{ clrscr(); cout<<"******************** LIBRARY DATABASE --> EDIT --> DISPLAY *********************"<<endl<<endl; fin.open("trans.dat"); fin.read((char*)&obj,sizeof(trans)); while (fin) { obj.display(); fin.read((char*)&obj,sizeof(trans)); } fin.close(); cout<<endl<<"Press a botton to return to EDIT page."; getch(); }; //*************************************************************************** // DELETE voidDeleteb(books obj) //books { ans='Y'; while(toupper(ans)=='Y') { clrscr(); cout<<"******************** LIBRARY DATABASE --> EDIT --> DELETE *****************"<<endl<<endl; cout<<"Enter the book ID to be deleted."<<endl; cin>>idcheck; fin.open("books.dat"); fout.open("temp.dat",ios::trunc); fin.read((char*)&obj,sizeof(books)); while (!fin.eof()) { if((idcheck)!=(obj.book_id)) { fout.write((char*)&obj,sizeof(books)); } fin.read((char*)&obj,sizeof(books)); } fin.close(); fout.close(); fout.open("books.dat",ios::trunc); fin.open("temp.dat"); fin.read((char*)&obj,sizeof(books)); while (!fin.eof()) { fout.write((char*)&obj,sizeof(books));
17 | P a g e

fin.read((char*)&obj,sizeof(books)); } fin.close(); fout.close(); cout<<"Do you wish to delete more? Y/N"; cin>>ans; } }; void Deletes(students obj) //students { ans='Y'; while(toupper(ans)=='Y') { clrscr(); cout<<"******************** LIBRARY DATABASE --> EDIT --> DELETE *****************"<<endl<<endl; cout<<"Enter the Student Roll no. to be deleted."<<endl; cin>>idcheck; fin.open("students.dat"); fout.open("temp.dat",ios::trunc); fin.read((char*)&obj,sizeof(students)); while (!fin.eof()) { if((idcheck)!=(obj.student_rno)) { fout.write((char*)&obj,sizeof(students)); } fin.read((char*)&obj,sizeof(students)); } fin.close(); fout.close(); fout.open("students.dat",ios::trunc); fin.open("temp.dat"); fin.read((char*)&obj,sizeof(students)); while (!fin.eof()) { fout.write((char*)&obj,sizeof(students)); fin.read((char*)&obj,sizeof(students)); } fin.close(); fout.close(); cout<<"Do you wish to delete more? Y/N"; cin>>ans; } };
18 | P a g e

//*************************************************************************** // MODIFY voidmodifyb(books obj) //books { ans='Y'; while(toupper(ans)=='Y') { clrscr(); cout<<"******************** LIBRARY DATABASE --> EDIT --> MODIFY *********************"<<endl<<endl; cout<<"Enter the book ID to be modified."<<endl; cin>>idcheck; fin.open("books.dat"); fout.open("temp.dat",ios::trunc); fin.read((char*)&obj,sizeof(books)); while (!fin.eof()) { if((idcheck)==(obj.book_id)) { clrscr(); cout<<"******************** LIBRARY DATABASE --> EDIT --> MODIFY *********************"<<endl<<endl; obj.getdata(); } fout.write((char*)&obj,sizeof(books)); fin.read((char*)&obj,sizeof(books)); } fin.close(); fout.close(); fout.open("books.dat",ios::trunc); fin.open("temp.dat"); fin.read((char*)&obj,sizeof(books)); while (!fin.eof()) { fout.write((char*)&obj,sizeof(books)); fin.read((char*)&obj,sizeof(books)); } fin.close(); fout.close(); cout<<"Do you wish to modify more? Y/N"; cin>>ans; } };
19 | P a g e

voidmodifys(students obj) //students { ans='Y'; while(toupper(ans)=='Y') { clrscr(); cout<<"******************** LIBRARY DATABASE --> EDIT --> MODIFY *********************"<<endl<<endl; cout<<"Enter the Student Roll no. to be modified."<<endl; cin>>idcheck; fin.open("students.dat"); fout.open("temp.dat",ios::trunc); fin.read((char*)&obj,sizeof(students)); while (!fin.eof()) { if((idcheck)==(obj.student_rno)) { clrscr(); cout<<"******************** LIBRARY DATABASE --> EDIT --> MODIFY *********************"<<endl<<endl; obj.getdata(); } fout.write((char*)&obj,sizeof(students)); fin.read((char*)&obj,sizeof(students)); } fin.close(); fout.close(); fout.open("students.dat",ios::trunc); fin.open("temp.dat"); fin.read((char*)&obj,sizeof(students)); while (!fin.eof()) { fout.write((char*)&obj,sizeof(students)); fin.read((char*)&obj,sizeof(students)); } fin.close(); fout.close(); cout<<"Do you wish to modify more? Y/N"; cin>>ans; } }; //************************************************************************** // INSERT voidinsertb(books obj) //books { int n;
20 | P a g e

ans='Y'; while(toupper(ans)=='Y') { n=0; clrscr(); cout<<"******************** LIBRARY DATABASE --> EDIT --> INSERT *********************"<<endl<<endl; cout<<"Enter the book ID you wish to insert."<<endl; cin>>idcheck; fin.open("books.dat"); fout.open("temp.dat",ios::trunc); fin.read((char*)&obj,sizeof(books)); while(!fin.eof()) { if (idcheck!=obj.book_id) { fout.write((char*)&obj,sizeof(books)); fin.read((char*)&obj,sizeof(books)); n++; } if (idcheck==obj.book_id) { obj.getdata(); fout.write((char*)&obj,sizeof(books)); fin.seekg(n*sizeof(books),ios::beg); fin.read((char*)&obj,sizeof(books)); fout.write((char*)&obj,sizeof(books)); fin.read((char*)&obj,sizeof(books)); } } fin.close(); fout.close(); fin.open("temp.dat"); fout.open("books.dat",ios::trunc); fin.read((char*)&obj,sizeof(books)); while(!fin.eof()) { fout.write((char*)&obj,sizeof(books)); fin.read((char*)&obj,sizeof(books)); } fin.close(); fout.close(); cout<<"Do you wish to insert more? Y/N"; cin>>ans; } };
21 | P a g e

void inserts(students obj) //students { int n; ans='Y'; while(toupper(ans)=='Y') { n=0; clrscr(); cout<<"******************** LIBRARY DATABASE --> EDIT --> INSERT *********************"<<endl<<endl; cout<<"Enter the Student Roll no. you wish to insert."<<endl; cin>>idcheck; fin.open("students.dat"); fout.open("temp.dat",ios::trunc); fin.read((char*)&obj,sizeof(students)); while(!fin.eof()) { if (idcheck!=obj.student_rno) { fout.write((char*)&obj,sizeof(students)); fin.read((char*)&obj,sizeof(students)); n++; continue; } if (idcheck==obj.student_rno) { obj.getdata(); fout.write((char*)&obj,sizeof(students)); fin.seekg(n*sizeof(students),ios::beg); fin.read((char*)&obj,sizeof(students)); fout.write((char*)&obj,sizeof(students)); fin.read((char*)&obj,sizeof(students)); } } fin.close(); fout.close(); fin.open("temp.dat"); fout.open("students.dat",ios::trunc); fin.read((char*)&obj,sizeof(students)); while(!fin.eof()) { fout.write((char*)&obj,sizeof(students)); fin.read((char*)&obj,sizeof(students)); }
22 | P a g e

fin.close(); fout.close(); cout<<"Do you wish to insert more? Y/N"; cin>>ans; } }; //*************************************************************************** // ISSUE void issue (trans objt,booksobjb,studentsobjs) { clrscr(); ans='Y'; intidcheckb,idchecks,flag; while(toupper(ans)=='Y') { flag=0; objt.getdata(); objt.trans_type='I'; cout<<"Enter the student rno.-"<<endl; cin>>idchecks; cout<<"Enter the book ID-"<<endl; cin>>idcheckb; fout.open("temp.dat"); fin.open("books.dat"); fin.read((char*)&objb,sizeof(books)); while(fin) { if(idcheckb==objb.book_id) { if (objb.book_issued<objb.book_copies) { objb.book_issued++; objb.totalno_issue++; objt.book_id=objb.book_id; strcpy(objt.book_name,objb.book_name); flag=1; } else { cout<<"No copy of the book is available.."; } } fout.write((char*)&objb,sizeof(books)); fin.read((char*)&objb,sizeof(books)); } fin.close();
23 | P a g e

fout.close(); fin.open("temp.dat"); fout.open("books.dat"); fin.read((char*)&objb,sizeof(books)); while(fin) { fout.write((char*)&objb,sizeof(books)); fin.read((char*)&objb,sizeof(books)); } fin.close(); fout.close(); fin.open("students.dat"); fout.open("temp.dat"); if(flag==1) { fin.read((char*)&objs,sizeof(students)); while(fin) { if (objs.student_rno==idchecks) { objt.student_rno=objs.student_rno; strcpy(objt.student_name,objs.student_name); } fout.write((char*)&objs,sizeof(students)); fin.read((char*)&objs,sizeof(students)); } } fin.close(); fout.close(); fin.open("temp.dat"); fout.open("students.dat"); fin.read((char*)&objs,sizeof(students)); while(fin) { fout.write((char*)&objs,sizeof(students)); fin.read((char*)&objs,sizeof(students)); } fin.close(); fout.close(); fout.open("trans.dat",ios::app); if (flag==1) { fout.write((char*)&objt,sizeof(trans)); } fout.close(); cout<<"Do you want to issue more? Y/N -";
24 | P a g e

cin>>ans; } }; //*************************************************************************** // RETURN void Return (trans objt,booksobjb,studentsobjs) { clrscr(); ans='Y'; intidcheckb,idchecks,flag; while(toupper(ans)=='Y') { flag=0; objt.getdata(); objt.trans_type='R'; cout<<"Enter the student no.-"<<endl; cin>>idchecks; cout<<"Enter the book ID-"<<endl; cin>>idcheckb; fout.open("temp.dat"); fin.open("books.dat"); fin.read((char*)&objb,sizeof(books)); while(fin) { if(idcheckb==objb.book_id) { if ((objb.book_copies-objb.book_issued)<objb.book_copies) { objb.book_issued--; objt.book_id=objb.book_id; strcpy(objt.book_name,objb.book_name); flag=1; } } fout.write((char*)&objb,sizeof(books)); fin.read((char*)&objb,sizeof(books)); } fin.close(); fout.close(); fin.open("temp.dat"); fout.open("books.dat"); fin.read((char*)&objb,sizeof(books)); while(fin) { fout.write((char*)&objb,sizeof(books)); fin.read((char*)&objb,sizeof(books));
25 | P a g e

} fin.close(); fout.close(); fin.open("students.dat"); fout.open("temp.dat"); if(flag==1) { fin.read((char*)&objs,sizeof(students)); while(fin) { if (objs.student_rno==idchecks) { objt.student_rno=objs.student_rno; strcpy(objt.student_name,objs.student_name); } fout.write((char*)&objs,sizeof(students)); fin.read((char*)&objs,sizeof(students)); } } fin.close(); fout.close(); fin.open("temp.dat"); fout.open("students.dat"); fin.read((char*)&objs,sizeof(students)); while(fin) { fout.write((char*)&objs,sizeof(students)); fin.read((char*)&objs,sizeof(students)); } fin.close(); fout.close(); fout.open("trans.dat",ios::app); if (flag==1) { fout.write((char*)&objt,sizeof(trans)); } fout.close(); cout<<"Do you want to return more? Y/N -"; cin>>ans; } }; //*************************************************************************** // SEARCH voidsearchb(books obj) { clrscr();
26 | P a g e

ans='Y'; while(toupper(ans)=='Y') { cout<<"Enter Book ID:-"; cin>>idcheck; fin.open("books.dat"); fin.read((char*)&obj,sizeof(books)); while(fin) { if(obj.book_id==idcheck) { obj.display(); } fin.read((char*)&obj,sizeof(books)); } fin.close(); cout<<"Do you want to search more? Y/N"; cin>>ans; } }; voidsearchs(students obj) { clrscr(); ans='Y'; while(toupper(ans)=='Y') { cout<<"Enter Student Roll no.:-"; cin>>idcheck; fin.open("students.dat"); fin.read((char*)&obj,sizeof(students)); while(fin) { if(obj.student_rno==idcheck) { obj.display(); } fin.read((char*)&obj,sizeof(students)); } fin.close(); cout<<"Do you want to search more? Y/N"; cin>>ans; } }; voidsearcht(trans obj)
27 | P a g e

{ clrscr(); ans='Y'; charidcheck[6]; while(toupper(ans)=='Y') { cout<<"Enter transaction code(5 characters):-"; cin>>idcheck; fin.open("trans.dat"); fin.read((char*)&obj,sizeof(trans)); while(fin) { if(strcmp(obj.trans_code,idcheck)==0) { obj.display(); } fin.read((char*)&obj,sizeof(trans)); } fin.close(); cout<<"Do you want to search more? Y/N"; cin>>ans; } }; //*************************************************************************** // REPORT void report(books objb,transobjt) { clrscr(); charcheck_date[9]; cout<<"Please enter today's date (dd-mm-yy):-"<<endl; cin>>check_date; clrscr(); int max=0; fin.open("books.dat"); fin.read((char*)&objb,sizeof(books)); while(fin) { if (objb.totalno_issue>max) { max=objb.totalno_issue; } fin.read((char*)&objb,sizeof(books)); } fin.close(); cout<<"The maximum book issued is:-"; fin.open("books.dat");
28 | P a g e

fin.read((char*)&objb,sizeof(books)); while(fin) { if(objb.totalno_issue==max) { cout<<"\t"<<objb.book_name<<endl<<endl; } fin.read((char*)&objb,sizeof(books)); } fin.close(); fin.open("trans.dat"); cout<<"Today's transactions are:-"<<endl; fin.read((char*)&objt,sizeof(trans)); while(fin) { if(strcmp(objt.date,check_date)==0) { objt.display(); } fin.read((char*)&objt,sizeof(trans)); } fin.close(); cout<<"Press any key to return to previous page."; getch(); }; //***********************************MAIN************************************ void main() { int a=DETECT,b,k; initgraph(&a,&b,"c:/turboc3/bgi"); setcolor(4); settextstyle(1,HORIZ_DIR,5); outtextxy(40,100,"WELCOME TO THE LIBRARY!!"); setcolor(2); settextstyle(2,HORIZ_DIR,9); outtextxy(90,175,"MADE BY Shubham Garg"); settextstyle(2,HORIZ_DIR,6); outtextxy(0,400,"PRESS ANY KEY TO CONTINUE..."); for (k=40;k<140;k++) { setcolor(rand()); arc(getmaxx()/2,350,0,180,k); } getch(); closegraph();
29 | P a g e

clrscr(); booksvarb; studentsvars; transvart; int ch1,ch2,ch3; a: clrscr(); cout<<"************************* WELCOME TO LIBRARY DATABASE **************************"<<endl<<endl; getoption(ch1); switch (ch1) { case 1: b: clrscr(); cout<<"********************* LIBRARY DATABASE --> CHOOSE DATABASE *********************"<<endl<<endl; getoptionpage2(ch2); switch(ch2) { case 1: c: clrscr(); cout<<"******************** LIBRARY DATABASE --> STUDENT DATABASE *********************"<<endl<<endl; getoptionpage3(ch3); switch(ch3) { case 1: adds(vars); goto c; case 2: modifys(vars); goto c; case 3: Deletes(vars); goto c; case 4: inserts(vars); goto c; case 5: displays(vars); goto c; case 6: searchs(vars);goto c; case 7: goto b; default: cout<<"Invalid Choice.."; getch(); goto c; } case 2: d: clrscr(); cout<<"********************* LIBRARY DATABASE --> BOOKS DATABASE **********************"<<endl<<endl; getoptionpage3(ch3); switch(ch3) { case 1: addb(varb); goto d; case 2: modifyb(varb); goto d; case 3: Deleteb(varb); goto d; case 4: insertb(varb); goto d; case 5: displayb(varb); goto d; case 6: searchb(varb); goto d; case 7: goto b;
30 | P a g e

default: cout<<"Invalid Choice.."; getch(); goto d; } case 3: goto a; default: cout<<"Invalid Choice.."; getch(); goto b; } case 2: e: clrscr(); cout<<"*********************** LIBRARY DATABASE --> TRANSACTION ***********************"<<endl<<endl; getoptionpage4(ch2); switch(ch2) { case 1: issue(vart,varb,vars); goto e; case 2: Return(vart,varb,vars); goto e; case 3: displayt(vart); goto e; case 4: searcht(vart); goto e; case 5: goto a; default: cout<<"Invalid Choice.."; getch(); goto e; } case 3: report(varb,vart); goto a; case 4: break; default: cout<<"Invalid Choice.."; getch(); goto a; } }

--- END OF PROGRAM----

31 | P a g e

SCREENSHOTS AND FLOW CHART

32 | P a g e

33 | P a g e

You might also like