+ All Categories
Home > Documents > Library Management Software C++

Library Management Software C++

Date post: 30-Nov-2015
Category:
Upload: amith-narayanan-ms
View: 499 times
Download: 0 times
Share this document with a friend
Description:
class 12 c++ project..
Popular Tags:
40
LIBRARY MANAGEMENT
Transcript
Page 1: Library Management Software C++

LIBRARY MANAGEMENT

Page 2: Library Management Software C++

ACKNOWLEDGEMENT

I sincerely thank Mrs.xyz, head of our Computer Department and our lab assistant Mrs.xyz for their support and guidance in completing the project in C++ on “LIBRARY MANAGEMMENT”, successfully. I also thank our principle, Dr.xyz for her kind support and the School Board for providing us with the facilities for doing the project.

TABLE OF CONTENTS

2

Page 3: Library Management Software C++

Chapter Page

SYSTEM Overview ………………………..………….. 5

SYSTEMS REQUIREMENTS SPECIFICATION Hardware and Software requirements ……………. 6 Problem Description ………………………………… 7

DESIGN SPECIFICATIONS File Design …………………………………………… 8 Procedural Design ………………………………….. 10

IMPLEMENTATION Program implementation with Program listing ……. 11 Sample Outputs ……………………………………… 25

CONCLUSION Limits of the project …………………………………. 31 Future Extensions …………………………………… 32

REFERENCES …………………………………………. 33

3

Page 4: Library Management Software C++

SYSTEM OVERVIEW

 Library Management system can manage all the happenings of the Library. Book transactions including Book Registration, Students Registration, Book Issuing, Current Status of a particular books etc. can be very easily handled by this module. Overall this system can be very helpful and it can make things easier

  The Library Management System is designed & developed for a receipt and issuance of books in the library along with the student’s details. The books received in the library are entered in Books Entry form and the new student is entered in the student entry form. When the student wants to get the desired book the same is issued on the availability basis to the student. The issuance and due date for the returning of the book is also entered into the Book Issue form under third menu Book Issue. The student has to pay the fine if any on the basis of no. of days delayed deposit of the book in the library.

4

Page 5: Library Management Software C++

HARDWARE AND SOFTWARE SPECIFICATION

HARDWARE SPECIFICATION

Server Intel® Pentium ® 4 CPU 3.2 GHz , 256 MB RAM , 160 GB HDD

Nodes Intel® Pentium ® 4 CPU 3.2 GHz , 256 MB RAM , 80 GB HDD

FDD 1.44 MbCD drive 52 XMonitor 14”SVGA Keyboard 107 keysMouse Optical mousePrinter HP DJ 1125C , WIPRO 132 Col Dot Matrix

Printer

SOFTWARE SPECIFICATION

Network Operating System

Windows NT 4.0

Software TURBO C++ Ver 3.0 , MySQL 5.1

Operating Environment

Windows XP Professional

5

Page 6: Library Management Software C++

PROBLEM DESCRIPTION

Our project on developing a program to implement LIBRARYMANAGEMENT was encoded using C++ language

The program is capable of performing the following tasks:

DATA SECURITY The data regarding books is password

protected and the file can be opened only by librarian.

ADDITION OF BOOKS It can feed the details about the book into

the system and save it as a file. UPDATING BOOKS DETAILS

It can change the details about the books any time.

SEARCH A BOOK It can search for a book, if name of the

book is provided. DELETING A BOOK

It allows librarian to delete a book.

The aim of this program is to fully automate the complete process of school library.

Having taken into account a number of practical issues, it was felt the inclusion of the following features would be essential to make it user friendly.

Menu Exit

6

Page 7: Library Management Software C++

FILE DESIGN

Physical files: books.dat, user.dat.

Logical files: fin, fout, file, fin2.

Structure name: books, user.

Structure variables: book, u.

Class name: librarian

Objects: libobj.

STRUCTURE books

VARIABLE DATA TYPE SIZE (bytes)

Code Char 10

Name Char 30

Author Char 20

Price Int 2

Status Int 2

7

Page 8: Library Management Software C++

STRUCTURE user

VARIABLE DATA TYPE SIZE (bytes)

ucode Char 10

bname Char 30

uauthor Char 20

bcode Char 10

uprice Int 2

CLASS Librarian

DATA MEMBERS DATA TYPE SIZE (bytes)

Status Char 10

8

Page 9: Library Management Software C++

PROCEDURAL DESIGN

Void userpage();Here the user-computer interface is handled. The user is allowed to issue a book, search for a book and view all the books available in the library.

Void libpage();Here the librarian-computer interface is handled. The librarian is allowed to add, delete, modify, and view user details.

Void searchbook();Here the function searches for the book in the file and reports to the user or librarian.

Void addbook();Here the function allows the librarian to add new books to the already existing file.

Void delbook(); Here the function allows the librarian to delete a book from

the file.

Void modify();Here the function allows the librarian to update the details about the book like code, author’s name and price.

9

Page 10: Library Management Software C++

PROGRAM IMPLEMENTATION

#include<fstream.h>#include<conio.h>#include<stdlib.h>#include<iomanip.h>#include<process.h>#include<stdio.h>#include<string.h>#include<time.h>#include<iostream.h>

//GLOBAL VARIABLESfstream file,fin,fout,fin2;

void mainmenu();

struct books{ char code[10]; char name[30]; char author[20]; int price; int status; }book;

struct user{char ucode[10];char bcode[10];char uname[30];char uauthor[20];int uprice;}u;

10

Page 11: Library Management Software C++

class librarian{ private: void update(); void password(); public: char status[10]; void display();}libobj;

void librarian::display(){ clrscr();

fin.open("books.dat",ios::binary|ios::in);if(!fin){ cout<<"\nCan't open file!!!"; getch(); exit(0);}cout<<"\n\n";cout<<setw(10)<<"CODE"<<setw(20)<<"NAME";

cout<<setw(20)<<"AUTHOR";cout<<setw(20)<<"PRICE";cout<<"\n___________________________________";cout<<"\n\n\n\n\n\n";while(fin.read((char*)&book,sizeof(book))){cout<<setw(10)<<book.code<<setw(20)<<book.name;

cout<<setw(20)<<book.author;cout<<setw(20)<<book.price;cout<<"\n\n\n\n";}fin.close();getch();

}

11

Page 12: Library Management Software C++

void display(){

cout<<"\n\n\n\n\n\n\n\n";cout<<setw(10)<<"CODE"<<setw(20)<<"NAME";

cout<<setw(20)<<"AUTHOR";cout<<setw(20)<<"PRICE";cout<<"\n __________________________________";cout<<"\n\n\n\n\n\n";cout<<setw(10)<<book.code<<setw(20)<<book.name;

cout<<setw(20);cout<<book.author<<setw(20)<<book.price;cout<<"\n\n\n\n";

}

void displayuser(){

cout<<setw(10)<<u.bcode<<setw(20)<<u.uname; cout<<setw(20)<<u.uauthor;

cout<<setw(20)<<u.uprice;cout<<"\n\n\n\n";

}

12

Page 13: Library Management Software C++

void modify(){ //LOCAL VARIABLES

clrscr(); char cd[30],a[20],n[20],st; float p; float np;

cout<<"\n\n\n\n\tEnter the code you want to modify : ";cout<<"\n\n\t[* to keep the original name -1 for price] : ";char c[30];gets(c);fstream f;f.open("BOOKS.DAT", ios::binary|ios::in|ios::out);while(f.read((char *)&book, sizeof(book)))

{if(strcmp(book.code,c) == 0){cout<<'\n';cout<<"\n\n\n\tNew Code :";gets(cd);cout<<"\n\n\n\tNew Name of book:";gets(n);cout<<"\n\n\n\tNew Author :";gets(a);cout<<"\n\n\n\tNew Price :";cin>>p;cout<<"\n\n\n\tStatus :";cin>>book.status; if(strcmp(cd,"*")!=0) strcpy(book.code,cd); if(strcmp(n,"*")!=0 ) strcpy(book.name,n); if(strcmp(a,"*")!=0)

13

Page 14: Library Management Software C++

strcpy(book.author,a); if(p!=-1) book.price=p;

f.seekp(f.tellg() - sizeof(book));f.write((char *)&book, sizeof(book));break;}

}f.close();

}

void searchbook(){ clrscr(); int k; char bname[30]; ofstream f;

f.open("user.dat",ios::binary|ios::app); cout<<"\n\n\n\tEnter the name of the book:"; gets(bname); fin.open("books.dat",ios::binary|ios::in);

while(fin.read((char*)&book,sizeof(book))) {

if(!fin) { cout<<"\nCan't open file!!!"; getch(); exit(0);

14

Page 15: Library Management Software C++

}if(strcmp(bname,book.name)==0){ if(book.status==2)

{cout<<"\n\n\tThe book is available....";display();cout<<"\n\n\n\tDo you want to issue this book(y/n)? ";char c;cin>>c;

if(c=='y'){

clrscr();cout<<"\n\n\n\tEnter your code : ";cin>>u.ucode;strcpy(u.bcode,book.code);strcpy(u.uname,book.name);strcpy(u.uauthor,book.author);u.uprice=book.price;

f.write((char *)&u,sizeof(u));clrscr();

cout<<"\n\n\n\n\n\tYOUR BOOK HAS BEEN ISSUED";cout<<"\n\n\n\tTHANK YOU!";

}}

15

Page 16: Library Management Software C++

else cout<<"\n\n\n\tSorry book already issued ";

k=1;}

} f.close();

if(k!=1)cout<<"\nThe book is currently not available....";

fin.close();getch();}

void userpage(){ clrscr(); int ch,n=1; do {

cout<<"\n\n\n\n\tUSER MENU "; cout<<"\n\n\n\n\n\n\n\n\n\t[1] ISSUE A BOOK"; cout<<"\n\n\n\n\n\t[2] DISPLAY ALL BOOKS"; cout<<"\n\n\n\n\n\t[3] BACK TO MAIN"; gotoxy(10,35); cout<<"\n\n\n\n\n\tEnter your choice here ->> "; cin>>ch;

switch(ch) {case 1:searchbook();

16

Page 17: Library Management Software C++

break;

case 2:libobj.display();break;

case 3:mainmenu(); default:cout<<"\nWrong choice !!!\a"; }

clrscr(); }while(n==1);}

void addbook(){ char ch='y';

fout.open("books.dat",ios::binary|ios::app);if(!fout){cout<<"\n\n\tCan't open file!!!";getch();exit(0);}while(ch=='y'||ch=='Y'){clrscr();cout<<"\n\n\n\n\tEnter the code : ";gets(book.code);cout<<"\n\n\n\n\tEnter the name of book : ";gets(book.name);cout<<"\n\n\n\n\tEnter the author : ";gets(book.author);cout<<"\n\n\n\n\tEnter the price : ";cin>>book.price;cout<<"\n\n\tEnter status(1 for issue 2 for not issued) : ";

17

Page 18: Library Management Software C++

cin>>book.status;fout.write((char*)&book,sizeof(book));cout<<"\n\n\n\n\n\n\tDo you want to continue?(y/n) : ";cin>>ch;}fout.close();

}

void delbook(){ int fd=0; char cde[10]; clrscr(); cout<<"\n\n\n\n\tEnter code of book to be deleted :: "; cin>>cde; fin.open("books.dat",ios::binary|ios::in|ios::app); fin2.open("temp.dat",ios::binary|ios::out|ios::app); while(fin.read((char*)&book,sizeof(book))) { if(strcmp(cde,book.code)!=0) fin2.write((char*)&book,sizeof(book));

} fin.close(); fin2.close(); remove("books.dat"); rename("temp.dat","books.dat");cout<<"\n\n\n\n\tBook deleted ";

getch();}

18

Page 19: Library Management Software C++

void userd() { char c[10],fd=0; ifstream f; f.open("user.dat",ios::binary|ios::in); clrscr(); cout<<"\n\n Enter the code of the user you want to see : "; gets(c);

cout<<"\n\n\n\n\n\n\n\n";cout<<setw(10)<<"CODE"<<setw(20)<<"NAME";

cout<<setw(20)<<"AUTHOR"; cout<<setw(20)<<"PRICE";

cout<<"\n__________________________________";cout<<"\n\n\n\n\n\n";while(f.read((char*)&u,sizeof(u))){

if(strcmp(u.ucode,c)==0){displayuser(); fd=1; }

}

getch();if (fd==0)cout<<"\n\n Such user does not exist !\a";getch();

f.close(); }

19

Page 20: Library Management Software C++

void libpage(){ char pwd[8]; int l=0,ch,n=1,i; clrscr(); pt: gotoxy(20,20); cout<<"ENTER THE PASSWORD(8 characters):: "; l++;

for(i=0;i<8;i++) { pwd[i]=getch(); cout<<"*"; } getch(); pwd[8]='\0'; if(strcmp(pwd,"password")==0) { cout<<"\nWELCOME"; } else if(l==3) exit(0); else { cout<<"\n\n\t\t WRONG PASSWORD!!!\a";

getch();clrscr();

goto pt; } clrscr(); do { cout<<"\n\n\n\n\n\t LIBRARY MENU "; cout<<"\n\n\n\n\n\t [1] Add a book"; cout<<"\n\n\n\n\n\t [2] Delete a book"; cout<<"\n\n\n\n\n\t [3] Update Book"; cout<<"\n\n\n\n\n\t [4] View user details";

20

Page 21: Library Management Software C++

cout<<"\n\n\n\n\n\t [5] View all books"; cout<<"\n\n\n\n\n\t [6] Main menu"; gotoxy(10,40); cout<<"Enter your choice here ->> "; cin>>ch;

switch(ch) {case 1:addbook();

break; case 2:delbook();

break; case 3:modify();

break; case 4:userd();

break; case 5:libobj.display();

break; case 6:mainmenu();

break; default:cout<<"\nWrong choice !!!"; } clrscr(); }while(n==1);}

void final() { clrscr(); gotoxy(25,20); cout<<"\n\n\n T H A N K Y O U ! "; }

21

Page 22: Library Management Software C++

void mainmenu() { int op; char ch='y'; do { clrscr();

time_t rawtime; time(&rawtime); cout<<"\n\n\n\n"; printf ("\n\n\n\t TIME:: %s", ctime (&rawtime) );

cout<<"\n\n\n\n\n\t\tM A I N M E N U\n\n\n\n\n"; cout<<"\t[1] USER\n\n\n\n\n"; cout<<"\t[2] LIBRARIAN\n\n\n\n\n"; cout<<"\t[3] EXIT\n\n\n\n\n"; gotoxy(10,40); cout<<"Enter your choice here -->>"; cin>>op;

switch(op) { case 1:userpage();

break; case 2:libpage();

break; case 3:final(); getch(); exit(0);

break; default:cout<<"\nINVALID OPTION...!!!\a\n"; } }while(ch=='y'||ch=='Y');

22

Page 23: Library Management Software C++

}

void main(){ clrscr(); gotoxy(20,20); cout<<"\n\n\n A B C PUBLIC SCHOOL LIBRARY "; cout<<" \n _____________________________________"; getch(); mainmenu(); getch();}

23

Page 24: Library Management Software C++

SCREEN SHOTS

24

Page 25: Library Management Software C++

25

Page 26: Library Management Software C++

26

Page 27: Library Management Software C++

27

Page 28: Library Management Software C++

28

Page 29: Library Management Software C++

29

Page 30: Library Management Software C++

LIMITS OF THE PROJECT

The password cannot be changed within the program

The program will accept two books having the same code.

Since the display is restricted to a single screen, too many books cannot be accommodated.

30

Page 31: Library Management Software C++

FUTURE EXTENSIONS

A more attractive, user friendly and compact interface is planned.

Provision for individual profile and accounts for users with password protection.

A more diverse classification of books, based on languages.

Error - auto correcting capable inputs at all stages.

31

Page 32: Library Management Software C++

REFERENCES

Computer science with C++: class XI By Sumita Arora

Computer science with C++: class XII By Sumita Arora

32


Recommended