Cs Project

1,368 views

Published on

It is investigatory project for class xii cbse. (LIBRARY MANAGEMENT)

Published in: Education
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total views
1,368
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
81
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

Cs Project

  1. 1. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 ACKNOWLEDGEMENT I would like to express my sincere gratitude to my project supervisor which is Ms. Vartika Sharma who guided me a lot throughout the project development. Without her guidance, I think I would not with this project. In addition, she gives me logic problems related to the project which is very useful to me. I would also like to thank my principal sir for providing us the lab which has all the facilities for developing this project. Our Librarian Sir also give his full co-operation when I went to ask the present working system of our library. My Friend circle also helps me a lot to overcome my problems. In trying to solve some logic errors I also get helped from my tuition teacher. At last I want to thank my parents for their cooperation and helping me at every stage of my life. Page 1
  2. 2. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA Library Management System Page 2 2013-14
  3. 3. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 ABSTRACT In Library, Librarian is the admin. Staff used to maintain record of one who is member of that library and the books that he/she had borrowed a book from that library. They also have to maintain a particular time period after which they have to pay some fine for their borrowed book. If someone lost some books then they have to pay price plus some fine for the book which is also maintained by them. So In order for Proper functioning Library staff have to maintain record for library members as well for the books they have in their library. In library with lakhs of books and hundreds f their member it is hard for the staff such lots of data. In order to get information about any member they have to fetch many records which is time consuming and also need more man power in big libraries. It is also difficult for staff to secure lots of data. Nowadays, we can use computers to came out of such difficulties. A simple library management system can do all these things without much man power nor it needed much time to fetch data about a particular book or library members. The proposed system can modify, delete, insert ad search record within few seconds and can also calculate the fine that an individual had to pay. Page 3
  4. 4. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA INDEX Topic Page No 1 – Introduction 7-8 1.1 Background of the study 7 1.2 Statement of problem/Objective 7 1.3 Hypothesis 8 1.4 Significance of the Project 8 1.5 Limitations of the study/Project 8 2 -Review of related literature 9 - 10 2.1 Opening A File 9 2.2 Closing A File 10 2.3 Writing To File 10 2.4 Reading From File 10 3 – Methodology 11-17 3.1 Methodology followed for the project 11 3.2 Requirement statement 12 3.2.1 12 3.2.2 3.3 For development For execution 12 Feasibility study for development 13 3.4.1 Technical 13 3.4.2 Economical 13 3.4.3 Behavioral 13 3.4 System Analysis 3.5 14 System Design 15-17 3.5.1 Flow charts 15 3.5.2 Class Design 16 Page 4 2013-14
  5. 5. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA Topic Page No 4 - Result and Discussion 18-31 4.1 Code 18 4.2 Snapshots 29 5 - Conclusion and recommendations 32 5.1 Conclusion 32 5.2 Recommendations 32 6 – Bibliography 33 Page 5 2013-14
  6. 6. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA FIGURE INDEX Topic Page No Main Menu 29 Administrator Menu 29 New Book Entry 30 New Student Entry 30 Book Issue 31 Book Deposit 31 Page 6 2013-14
  7. 7. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 1. INTRODUCTION I. Background of the Study:I’ve seen librarian struggling with records while when we go to issue or deposit a book. This manual system is time consuming and record can even be easily lost. This gives me an idea to develop a program which can be economically or behaviorally feasible for the users. Little development in this program can be done so that it can be easily used in other record keeping like in hotels, hospitals, etc. II. Statement of Problems and Objectives:Problems:Some of the problems being faced in manual system are as follows: 1. Fast report generation is not possible. 2. Tracing a book is difficult. 3. Information about issue/return of the books are not properly maintained. 4. No central database can be created as information is not available in database. Objective:1. It Reduces Paperwork. 2. Reduce the workload of employee. 3. Faster retrieval of information about the desired book. 4. Provide facility for proper monitoring reduces paper work and provide data security. 5. All details will be available on just few seconds. Page 7
  8. 8. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 III. Hypothesis:I’ve started this program with an objective to develop it for keeping record of books for student in library with ten books can be issued per student. But I was f ailed because it makes program too complex so I’ve developed this program with a limitation that a student can only issue one book. IV. Significance of Project:This Project is suitable for small and medium size library. It is use by librarian and library admin to manage the library using a computerized system. This system was developed and designed to help librarian record every transaction so that the problem such as record missing will not be happened. A centralized storage system behind it will help a lot for maintaining a record. Modification on the available data will be easier and there is no need to fill the whole record for just a small change. This proposed system is more efficient and quick in order to find a record . V. Delimitation and Limitation Of Project:Delimitation:1.It is more efficient than present day manual system. 2. Reduced Data Insecurity. 3.Reduces Paper Work. 4.Reduces Work load and need much less time to find a particular record. Page 8
  9. 9. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 Limitation:1.It work on very old language platform and hence most of the computer had to install turbo C++ for the execution of the program. 2.It doesn’t work on database which can be very useful in efficiency and speed processing for our records. 2. REVIEW OF THE RELATED LITERATURE Data Type Description Ofstream This data type represents the output file stream and is used to create files and to write information to files. Ifstream This data type represents the input file stream and is used to read information from files. Fstream This data type represents the file stream generally, and has the capabilities of both ofstream and ifstream which means it can create files, write information to files, and read information from files. To perform file processing in C++, header files <iostream> and <fstream> must be included in your C++ source file. Opening a File: A file must be opened before you can read from it or write to it. Either the ofstream or fstream object may be used to open a file for writing and ifstream object is used to open a file for reading purpose only. Following is the standard syntax for open() function, which is a member of fstream, ifstream, and ofstream objects. void open(const char *filename, ios::openmode mode); Here, the first argument specifies the name and location of the file to be opened and the second argument of the open() member function defines the mode in which the file should be opened. Page 9
  10. 10. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA Mode Flag Description ios::app Append mode. All output to that file to be appended to the end. ios::ate Open a file for output and move the read/write control to the end of the file. ios::in Open a file for reading. ios::out Open a file for writing. ios::trunc 2013-14 If the file already exists, its contents will be truncated before opening the file. For example if you want to open a file in write mode and want to truncate it in case it already exists, following will be the syntax: ofstream outfile; outfile.open("file.dat", ios::out | ios::trunc ); Similar way, you can open a file for reading and writing purpose as follows: fstream afile; afile.open("file.dat", ios::out | ios::in ); Closing a File: When a C++ program terminates it automatically closes flushes all the streams, release all the allocated memory and close all the opened files. But it is always a good practice that a programmer should close all the opened files before program termination. Following is the standard syntax for close() function, which is a member of fstream, ifstream, and ofstream objects. void close(); Writing to a File: While doing C++ programming, you write information to a file from your program using the stream insertion operator (<<) just as you use that operator to output information to the screen. The only difference is that you use an ofstream or fstream object instead of the cout object . Page 10
  11. 11. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 Reading from a File: We read information from a file into your program using the stream extraction operator (>>) just as you use that operator to input information from the keyboard. The only difference is that you use an ifstream or fstream object instead of the cin object. 3. Methodology I. Flow Chart(Methodology followed for the project) Page 11
  12. 12. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA II. 2013-14 Requirement Statement – System Requirement For Development Turbo C++, Borland C++. Page 12
  13. 13. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 Windows XP, Vista, 7,8 or Mac OSx or equivalent. Processor – Intel P4 or Later 256 of RAM or higher For Execution Turbo C++, Borland C++ . Windows XP, Vista, 7,8 or Mac OSx or equivalent. Processor – Intel P4 or Later 256 MB of RAM or higher III. Feasibility Study A. Technical It needed a pc with the above given requirements and a turbo C++ software for its execution. Page 13
  14. 14. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 B. Economical I have uses the resources of my lab to develop this program and there is light interface for the user and hence I can say that it can be easily feasible for even small libraries with minimal cost. C. Behavioral This software is an effort to reduce man work in library. The users had to give just input while other works like calculation, updating, inserting and usually all most all the functions of a record it can do. I even use an easy use of English language so that user will not face difficulty for operating the program. This project can be executable on C++ platform all you need to install turbo C++ with the above requirement .The menu driven program help the user to choose whatever they need and good use of retrieval in the program will provide a better interaction interface for the user. IV. SYSTEM ANALYSIS Some of the problems being faced in manual system are as follows: 1. Fast report generation is not possible. 2. Tracing a book is difficult. Page 14
  15. 15. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 3. Information about issue/return of the books are not properly maintained. 4. No central database can be created as information is not available in database. Proposed system provides with following solutions : 1. It provides "better and efficient" service to members. 2. Reduce the workload of employee. 3. Faster retrieval of information about the desired book. 4. Provide facility for proper monitoring reduce paper work and provide data security. 5. All details will be available on a click. V. SYSTEM DESIGN A. Flowchart::Page 15
  16. 16. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 STOP B. Class Design:B.1. Class Name : book Page 16
  17. 17. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA Private Member bno[6] Character string type bname[50] Character string type aname[20] Character string type Public Members: create_book(); void type show_book(); void type modify_book(); void type report(); void type retbno(); pointer type B.2 Class Name : student Private Members: Page 17 2013-14
  18. 18. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA admno[6] Character string type name[20] Character string type stbno[6] Character string type token Integer Type Public Members: create_student(); void type show_student(;) void type modify_student(); void type retadmno(); Pointer type retstbno(); Pointer type rettoken(); integer type 4.RESULT AND DISCUSSION Code:#include<fstream.h> #include<conio.h> #include<stdio.h> #include<process.h> #include<string.h> Page 18 2013-14
  19. 19. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA #include<iomanip.h> class book { char bno[6]; char bname[50]; char aname[20]; public: void create_book() { cout<<"nNEW BOOK ENTRY...n"; cout<<"nEnter The book no."; cin>>bno; cout<<"nnEnter The Name of The Book "; gets(bname); cout<<"nnEnter The Author's Name "; gets(aname); cout<<"nnnBook Created.."; } void show_book() { cout<<"nBook no. : "<<bno; cout<<"nBook Name : "; puts(bname); cout<<"Author Name : "; puts(aname); } void modify_book() { cout<<"nBook no. : "<<bno; cout<<"nModify Book Name : "; gets(bname); cout<<"nModify Author's Name of Book : "; gets(aname); } char* retbno() { return bno; } void report() {cout<<bno<<setw(30)<<bname<<setw(30)<<aname<<endl;} }; //class ends here class student { Page 19 2013-14
  20. 20. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA char admno[6]; char name[20]; char stbno[6]; int token; public: void create_student() { clrscr(); cout<<"nNEW STUDENT ENTRY...n"; cout<<"nEnter The admission no. "; cin>>admno; cout<<"nnEnter The Name of The Student "; gets(name); token=0; stbno[0]='/0'; cout<<"nnStudent Record Created.."; } void show_student() { cout<<"nAdmission no. : "<<admno; cout<<"nStudent Name : "; puts(name); cout<<"nNo of Book issued : "<<token; if(token==1) cout<<"nBook No "<<stbno; } void modify_student() { cout<<"nAdmission no. : "<<admno; cout<<"nModify Student Name : "; gets(name); } char* retadmno() { return admno; } char* retstbno() { return stbno; } int rettoken() { return token; } void addtoken() {token=1;} void resettoken() Page 20 2013-14
  21. 21. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA {token=0;} void getstbno(char t[]) { strcpy(stbno,t); } void report() {cout<<"t"<<admno<<setw(20)<<name<<setw(10)<<token<<endl;} }; //class ends here fstream fp,fp1; book bk; student st; void write_book() { char ch; fp.open("book.dat",ios::out|ios::app); do { clrscr(); bk.create_book(); fp.write((char*)&bk,sizeof(book)); cout<<"nnDo you want to add more record..(y/n?)"; cin>>ch; }while(ch=='y'||ch=='Y'); fp.close(); } void write_student() { char ch; fp.open("student.dat",ios::out|ios::app); do { st.create_student(); fp.write((char*)&st,sizeof(student)); cout<<"nndo you want to add more record..(y/n?)"; cin>>ch; }while(ch=='y'||ch=='Y'); fp.close(); } Page 21 2013-14
  22. 22. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA void display_spb(char n[]) { cout<<"nBOOK DETAILSn"; int flag=0; fp.open("book.dat",ios::in); while( fp.read((char*)&bk,sizeof(book)) ) { if(strcmpi(bk.retbno(),n)==0) { bk.show_book(); flag=1; } } fp.close(); if(flag==0) cout<<"nnBook does not exist"; getch(); } void display_sps(char n[]) { cout<<"nSTUDENT DETAILSn"; int flag=0; fp.open("student.dat",ios::in); while(fp.read((char*)&st,sizeof(student))) { if((strcmpi(st.retadmno(),n)==0)) { st.show_student(); flag=1; } } fp.close(); if(flag==0) cout<<"nnStudent does not exist"; getch(); } void modify_book() { char n[6]; int found=0; clrscr(); cout<<"nntMODIFY BOOK REOCORD.... "; cout<<"nntEnter The book no. of The book"; cin>>n; fp.open("book.dat",ios::in|ios::out); while(fp.read((char*)&bk,sizeof(book))) { Page 22 2013-14
  23. 23. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA if(strcmpi(bk.retbno(),n)==0) { bk.show_book(); cout<<"nEnter The New Details of book"<<endl; bk.modify_book(); int pos=-1*sizeof(bk); fp.seekp(pos,ios::cur); fp.write((char*)&bk,sizeof(book)); cout<<"nnt Record Updated"; found=1; } } fp.close(); if(found==0) cout<<"nn Record Not Found "; getch(); } void modify_student() { char n[6]; int found=0; clrscr(); cout<<"nntMODIFY STUDENT RECORD... "; cout<<"nntEnter The admission no. of The student"; cin>>n; fp.open("student.dat",ios::in|ios::out); while(fp.read((char*)&st,sizeof(student))) { if(strcmpi(st.retadmno(),n)==0) { st.show_student(); cout<<"nEnter The New Details of student"<<endl; st.modify_student(); int pos=-1*sizeof(st); fp.seekp(pos,ios::cur); fp.write((char*)&st,sizeof(student)); cout<<"nnt Record Updated"; found=1; } } fp.close(); if(found==0) cout<<"nn Record Not Found "; getch(); } void delete_student() { Page 23 2013-14
  24. 24. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 char n[6]; int flag=0; clrscr(); cout<<"nnntDELETE STUDENT..."; cout<<"nnEnter The admission no. of the Student You Want To Delete : "; cin>>n; fp.open("student.dat",ios::in|ios::out); fstream fp2; fp2.open("Temp.dat",ios::out); while(fp.read((char*)&st,sizeof(student))) { if(strcmpi(st.retadmno(),n)!=0) fp2.write((char*)&st,sizeof(student)); else flag=1; } fp2.close(); fp.close(); remove("student.dat"); rename("Temp.dat","student.dat"); if(flag==1) cout<<"nntRecord Deleted .."; else cout<<"nnRecord not found"; getch(); } void delete_book() { char n[6]; clrscr(); cout<<"nnntDELETE BOOK ..."; cout<<"nnEnter The Book no. of the Book You Want To Delete : "; cin>>n; fp.open("book.dat",ios::in|ios::out); fstream fp2; fp2.open("Temp.dat",ios::out); while(fp.read((char*)&bk,sizeof(book))) { if(strcmpi(bk.retbno(),n)!=0) { fp2.write((char*)&bk,sizeof(book)); } } fp2.close(); fp.close(); remove("book.dat"); rename("Temp.dat","book.dat"); cout<<"nntRecord Deleted .."; Page 24
  25. 25. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 getch(); } void display_alls() { clrscr(); fp.open("student.dat",ios::in); if(!fp) { cout<<"ERROR!!! FILE COULD NOT BE OPEN "; getch(); return; } cout<<"nnttSTUDENT LISTnn"; cout<<"==============================================================n; cout<<"tAdmission No."<<setw(10)<<"Name"<<setw(20)<<"Book Issuedn"; cout<<"=============================================================n"; while(fp.read((char*)&st,sizeof(student))) { st.report(); } fp.close(); getch(); } void display_allb() { clrscr(); fp.open("book.dat",ios::in); if(!fp) { cout<<"ERROR!!! FILE COULD NOT BE OPEN "; getch(); return; } cout<<"nnttBook LISTnn"; cout<<"=============================================================n"; cout<<"Book Number"<<setw(20)<<"Book Name"<<setw(25)<<"Authorn"; cout<<"=============================================================n"; while(fp.read((char*)&bk,sizeof(book))) { bk.report(); Page 25
  26. 26. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 } fp.close(); getch(); } void book_issue() { char sn[6],bn[6]; int found=0,flag=0; clrscr(); cout<<"nnBOOK ISSUE ..."; cout<<"nntEnter The student's admission no."; cin>>sn; fp.open("student.dat",ios::in|ios::out); fp1.open("book.dat",ios::in|ios::out); while(fp.read((char*)&st,sizeof(student)) && found==0) { if(strcmpi(st.retadmno(),sn)==0) { found=1; if(st.rettoken()==0) { cout<<"nntEnter the book no. "; cin>>bn; while(fp1.read((char*)&bk,sizeof(book))&& flag==0) { if(strcmpi(bk.retbno(),bn)==0) { bk.show_book(); flag=1; st.addtoken(); st.getstbno(bk.retbno()); int pos=-1*sizeof(st); fp.seekp(pos,ios::cur); fp.write((char*)&st,sizeof(student)); cout<<"nnt Book issued successfully"; cout<<"nnPlease Note: Submit within 15 days fine Rs. 1 for each day"; cout<<"nnafter 15 days period"; } } if(flag==0) cout<<"Book no does not exist"; } else cout<<"You have not returned the last book "; } } if(found==0) cout<<"Student record not exist..."; Page 26
  27. 27. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA getch(); fp.close(); fp1.close(); } void book_deposit() { char sn[6],bn[6]; int found=0,flag=0,day,fine; clrscr(); cout<<"nnBOOK DEPOSIT ..."; cout<<"nntEnter The student’s admission no."; cin>>sn; fp.open("student.dat",ios::in|ios::out); fp1.open("book.dat",ios::in|ios::out); while(fp.read((char*)&st,sizeof(student)) && found==0) { if(strcmpi(st.retadmno(),sn)==0) { found=1; if(st.rettoken()==1) { while(fp1.read((char*)&bk,sizeof(book))&& flag==0) { if(strcmpi(bk.retbno(),st.retstbno())==0) { bk.show_book(); flag=1; cout<<"nnBook deposited in no. of days"; cin>>day; if(day>15) { fine=(day-15)*1; cout<<"nnFine has to deposited Rs. "<<fine; } st.resettoken(); int pos=-1*sizeof(st); fp.seekp(pos,ios::cur); fp.write((char*)&st,sizeof(student)); cout<<"nnt Book deposited successfully"; } } if(flag==0) cout<<"Book no does not exist"; } else cout<<"No book is issued..please check!!"; } } if(found==0) cout<<"Student record not exist..."; Page 27 2013-14
  28. 28. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 getch(); fp.close(); fp1.close(); } void admin_menu() { clrscr(); int ch2; cout<<"nnntADMINISTRATOR MENU"; cout<<"nnt1.CREATE STUDENT RECORD"; cout<<"nnt2.DISPLAY ALL STUDENTS RECORD"; cout<<"nnt3.DISPLAY SPECIFIC STUDENT RECORD "; cout<<"nnt4.MODIFY STUDENT RECORD"; cout<<"nnt5.DELETE STUDENT RECORD"; cout<<"nnt6.CREATE BOOK "; cout<<"nnt7.DISPLAY ALL BOOKS "; cout<<"nnt8.DISPLAY SPECIFIC BOOK "; cout<<"nnt9.MODIFY BOOK "; cout<<"nnt10.DELETE BOOK "; cout<<"nnt11.BACK TO MAIN MENU"; cout<<"nntPlease Enter Your Choice (1-11) "; cin>>ch2; switch(ch2) { case 1: clrscr(); write_student();break; case 2: display_alls();break; case 3: char num[6]; clrscr(); cout<<"nntPlease Enter The Admission No. "; cin>>num; display_sps(num); break; case 4: modify_student();break; case 5: delete_student();break; case 6: clrscr(); write_book();break; case 7: display_allb();break; case 8: { char num[6]; clrscr(); cout<<"nntPlease Enter The book No. "; cin>>num; display_spb(num); break; } case 9: modify_book();break; case 10: delete_book();break; case 11: return; Page 28
  29. 29. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA default:cout<<"a"; } admin_menu(); } //*************************************************************** // THE MAIN FUNCTION OF PROGRAM //**************************************************************** void main() { char ch; do { clrscr(); cout<<"nnntMAIN MENU"; cout<<"nnt01. BOOK ISSUE"; cout<<"nnt02. BOOK DEPOSIT"; cout<<"nnt03. ADMINISTRATOR MENU"; cout<<"nnt04. EXIT"; cout<<"nntPlease Select Your Option (1-4) "; ch=getch(); switch(ch) { case '1':clrscr(); book_issue(); break; case '2':book_deposit(); break; case '3':admin_menu(); break; case '4':exit(0); default :cout<<"a"; } }while(ch!='4'); } Page 29 2013-14
  30. 30. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA Snapshots:- Page 30 2013-14
  31. 31. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA Page 31 2013-14
  32. 32. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA Page 32 2013-14
  33. 33. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 5.CONCLUSION AND RECOMMENDATION I. CONCLUSION:- This project aims to replace the manual work of making a record and we think it would be able in its motto of doing so. We have included certain functions for deleting record, updating a record, viewing records for the simplicity of the user. II. RECOMMENDATION:- We hereby invite any recommendations or suggestions for the betterment of this project. There are some limitations of this project as is the case with all projects. No system till date has been designed which is errorless or without limitations. Page 33
  34. 34. KENDRIYA VIDYALAYA NO.1 AFS KALAIKUNDA 2013-14 6. BIBLIOGRAPHY I‘ve get constant support for the development of my program from:- i) Object Oriented Programming with C++ by E BALAGURUSAMY ii) www.cppforschool.com Page 34

×