├── Screenshots
├── Screenshot (410).png
├── Screenshot (411).png
└── Screenshot (412).png
├── README.md
└── LMSCode.cpp
/Screenshots/Screenshot (410).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TusharKukra/LMS-Library-Management-System/HEAD/Screenshots/Screenshot (410).png
--------------------------------------------------------------------------------
/Screenshots/Screenshot (411).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TusharKukra/LMS-Library-Management-System/HEAD/Screenshots/Screenshot (411).png
--------------------------------------------------------------------------------
/Screenshots/Screenshot (412).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TusharKukra/LMS-Library-Management-System/HEAD/Screenshots/Screenshot (412).png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Library Management System
2 |
3 |
In this Library Management System project, you can enter the record of new books and retrieve the details of books available in the library. You can issue the books to the students and maintain their records. Late fine is charged for students who returns the issued books after the due date.Only one book is issued to students. New book is not issued to students those not returned the last book.
4 |
5 | 
6 |
--------------------------------------------------------------------------------
/LMSCode.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include//input-output manipulator
4 | #include
5 | #include
6 | #include
7 | #include
8 | class book
9 | {
10 | char bno[6];//bookno.
11 | char bname[50];//bookname
12 | char aname[20];//authorname
13 | public:
14 | void createbook()
15 | {
16 | cout<<"\nNEW BOOK ENTRY...\n";
17 | cout<<"\nENTER BOOK NO.";
18 | cin>>bno;
19 | cout<<"\nENTER BOOK NAME";
20 | gets(bname);//enables enter with space
21 | cout<<"\nENTER AUTHOR NAME";
22 | gets(aname);
23 | cout<<"\n\n\nBook Created..";
24 | }
25 | void showbook()
26 | {
27 | cout<<"\nBook Number: "<>admno;
67 | cout<<"Enter The Student Name ";
68 | gets(name);
69 | token=0;
70 | stbno[0]='\0';
71 | cout<<"\n\nStudent Record Created...";
72 | }
73 | void showstudent()
74 | {
75 | cout<<"\nAdmission Number : "<>ch;
133 | }while(ch=='y'||ch=='Y');
134 | fp.close();
135 | }
136 |
137 | void writestudent()
138 | {
139 | char ch;
140 | fp.open("student.dat",ios::out|ios::app);//write and append data
141 | do{
142 | clrscr();
143 | st.createstudent();
144 | fp.write((char*)&st,sizeof(student));//size of class
145 | cout<<"\n\nDo you want to add more record...(y/n?) ";
146 | cin>>ch;
147 | }while(ch=='y'||ch=='Y');
148 | fp.close();
149 | }
150 | void displayspb(char n[])
151 | {
152 | cout<<"\nBOOK DETAILS\n";
153 | int flag=0;//book not found
154 | fp.open("book.dat",ios::in);//read data
155 | while(fp.read((char *)&bk,sizeof(book)))
156 | {
157 | if(strcmpi(bk.retbno(),n)==0)//not case sensitive
158 | {
159 | bk.showbook();
160 | flag=1;
161 | }
162 | }
163 | fp.close();
164 | if(flag==0)//book not found
165 | {
166 | cout<<"\n\nBook does not exist";
167 |
168 | }
169 | getch();
170 | }
171 | void displaysps(char n[])
172 | {
173 | cout<<"\nSTUDENT DETAILS\n";
174 | int flag=0;//student not found
175 | fp.open("student.dat", ios::in);//read data
176 | while(fp.read((char *)&st,sizeof(student)))
177 | {
178 | if(strcmpi(st.retadmno(),n)==0)//not case sensitive
179 | {
180 | st.showstudent();
181 | flag=1;
182 | }
183 | }
184 | fp.close();
185 | if(flag==0)//student not found
186 | {
187 | cout<<"\n\nStudent does not exist";
188 |
189 | }
190 | getch();
191 | }
192 | void modifybook()
193 | {
194 | char n[6];
195 | int found=0;//seach book of given data
196 | clrscr();
197 | cout<<"\n\nMODIFY BOOK RECORD...";
198 | cout<<"\n\nEnter the book no. ";
199 | cin>>n;
200 | fp.open("book.dat",ios::in|ios::out);
201 | while(fp.read((char*)&bk,sizeof(book)) && found==0)
202 | {
203 | if(strcmpi(bk.retbno(),n)==0)
204 | {
205 | bk.showbook();
206 | cout<<"\nEnter the new details book";
207 | bk.modifybook();
208 | int pos=-1*sizeof(bk);
209 | fp.seekp(pos,ios::cur);//back from current position
210 | fp.write((char *)&bk,sizeof(book));
211 | cout<<"\n\nRecord Updated";
212 | found=1;
213 | }
214 |
215 | }
216 | fp.close();
217 | if(found==0)
218 | {
219 | cout<<"\n\nRecord Not Found";
220 |
221 | }
222 | getch();//press key to get out
223 | }
224 | void modifystudent()
225 | {
226 | char n[6];
227 | int found=0;//seach book of given data
228 | clrscr();
229 | cout<<"\n\nMODIFY STUDENT RECORD...";
230 | cout<<"\n\nEnter the Admission no. ";
231 | cin>>n;
232 | fp.open("student.dat",ios::in|ios::out);
233 | while(fp.read((char*)&st,sizeof(student)) && found==0)
234 | {
235 | if(strcmpi(st.retadmno(),n)==0)
236 | {
237 | st.showstudent();
238 | cout<<"\nEnter the new details of student";
239 | st.modifystudent();
240 | int pos=-1*sizeof(st);
241 | fp.seekp(pos,ios::cur);//back from current position
242 | fp.write((char *)&st,sizeof(student));
243 | cout<<"\n\nRecord Updated";
244 | found=1;
245 | }
246 |
247 | }
248 | fp.close();
249 | if(found==0)
250 | {
251 | cout<<"\n\nRecord Not Found";
252 |
253 | }
254 | getch();//press key to get out
255 | }
256 |
257 | void deletestudent()
258 | {
259 | char n[6];
260 | int flag=0;
261 | clrscr();
262 | cout<<"\n\n\n\tDELETE STUDENT...";
263 | cout<<"\n\nEnter the Admission no> : ";
264 | cin>>n;
265 | fp.open("student.dat",ios::in|ios::out);
266 | fstream fp2;
267 | fp2.open("temp.dat",ios::out);
268 | fp.seekg(0,ios::beg);
269 | while(fp.read((char*)&st,sizeof(student)))
270 | {
271 | if(strcmpi(st.retadmno(),n)!=0)
272 | {
273 | fp2.write((char*)&st,sizeof(student));
274 | }
275 | else{
276 | flag=1;//student found
277 | }
278 | }
279 | fp2.close();
280 | fp.close();
281 | remove("student.dat");
282 | rename("temp.dat","student.dat");//data after deletion moved to temp
283 | if(flag==1)
284 | {
285 | cout<<"\n\n\tRecord Deleted..";
286 | }
287 | else
288 | {
289 | cout<<"\n\nRecord not Found";
290 | }
291 | getch();
292 | }
293 | void deletebook()
294 | {
295 | char n[6];//book no.
296 | int flag=0;
297 | clrscr();
298 | cout<<"\n\n\n\tDELETE BOOK...";
299 | cout<<"\n\nEnter the Book no> : ";
300 | cin>>n;
301 | fp.open("book.dat",ios::in|ios::out);
302 | fstream fp2;//New onject
303 | fp2.open("Temp.dat",ios::out);//temp having data else than that to be deleted
304 | fp.seekg(0,ios::beg);
305 | while(fp.read((char*)&bk,sizeof(book)))
306 | {
307 | if(strcmpi(bk.retbno(),n)!=0)
308 | {
309 | fp2.write((char*)&st,sizeof(book));
310 | }
311 | else{
312 | flag=1;//student found
313 | }
314 | }
315 | fp2.close();
316 | fp.close();
317 | remove("book.dat");
318 | rename("Temp.dat","book.dat");//data after deletion moved to temp
319 | if(flag==1)
320 | {
321 | cout<<"\n\n\tRecord Deleted... ";
322 | }
323 | else
324 | {
325 | cout<<"\n\nRecord not Found";
326 | }
327 | getch();
328 | }
329 | void displayalls()
330 | {
331 | clrscr();
332 | fp.open("student.dat",ios::in);//read mode
333 | if(!fp)
334 | {
335 | cout<<"File Could Not Be Open";
336 | getch();
337 | return;//press any key and return
338 | }
339 | cout<<"\n\n\t\tStudent List\n\n";
340 | cout<<"==================================================================\n";
341 | cout<<"\tAdmission No."<>sn;
379 | fp.open("student.dat",ios::in|ios::out);
380 | fp1.open("book.dat",ios::in|ios::out);
381 | while(fp.read((char*)&st,sizeof(student))&& found==0)
382 | {
383 | if(strcmpi(st.retadmno(),sn)==0)//compare admsn no.
384 | {
385 | found=1;
386 | if(st.rettoken()==0)//if book not issued
387 | {
388 | cout<<"\n\n\tEnter The Book No.";
389 | cin>>bn;
390 | while(fp1.read((char*)&bk,sizeof(book))&& flag==0)
391 | {
392 | if(strcmpi(bk.retbno(),bn)==0)//compare book no.
393 | {
394 | flag=1;
395 | st.addtoken();
396 | st.getstbno(bk.retbno());//pass book no.
397 | int pos=-1*sizeof(st);
398 | fp.seekg(pos,ios::cur);
399 | fp.write((char*)&st,sizeof(student));
400 | cout<<"\n\n\tBook Issued Successfully\n\n Please Note The Book Issue Date On Backside Of Your Book And Return Book Within 15 Days, Otherwise Fine Of 15 Rs Per Day";
401 |
402 |
403 | }
404 | }
405 | if(flag==0)
406 | {
407 | cout<<"Book No. Does Not Exists";
408 | }
409 |
410 | }
411 |
412 | else
413 | {
414 |
415 | cout<<"You Have Not Returned The Last Book";
416 |
417 | }
418 |
419 |
420 |
421 | }
422 |
423 | }
424 | if(found==0)
425 | {
426 | cout<<"Student Record Not Exists...";
427 |
428 | }
429 | getch();
430 | fp.close();
431 | fp1.close();
432 | }
433 |
434 | void bookdeposit()
435 | {
436 | char sn[6],bn[6];
437 | int found=0,flag=0,day,fine;
438 | clrscr();
439 | cout<<"\n\nBOOK DEPOSIT...";
440 | cout<<"\n\n\tEnter Admission no. Of Student";
441 | cin>>sn;
442 | fp.open("student.dat",ios::in|ios::out);
443 | fp1.open("book.dat",ios::in|ios::out);
444 | while(fp.read((char*)&st,sizeof(student))&& found==0)
445 | {
446 | if(strcmpi(st.retadmno(),sn)==0)//compare admsn no.
447 | {
448 | found=1;
449 | if(st.rettoken()==1)//if book issued
450 | {
451 | while(fp1.read((char*)&bk,sizeof(book))&& flag==0)
452 | {
453 | if(strcmpi(bk.retbno(),st.retstbno())==0)
454 | {
455 | flag=1;
456 | bk.showbook();
457 | cout<<"\n\n Book Deposited In No. Of Days";
458 | cin>>day;
459 | if(day>15)
460 | {
461 | fine=(day-15)*1;
462 | cout<<"\n\n Fine = "<>ch2;
533 | switch(ch2)
534 | {
535 | case 1: writestudent();
536 | break;
537 | case 2: displayalls();
538 | break;
539 | case 3: char num[6];
540 | clrscr();
541 | cout<<"\n\n\t Please enter admission no.";
542 | cin>>num;
543 | displaysps(num);
544 | break;
545 | case 4: modifystudent();
546 | break;
547 | case 5:deletestudent();
548 | break;
549 | case 6:writebook();
550 | break;
551 | case 7:displayallb();
552 | break;
553 | case 8:
554 | {char num[6];
555 | clrscr();
556 | cout<<"\n\n\tPlease enter book no.";
557 | cin>>num;
558 | displayspb(num);
559 | break;
560 | }
561 | case 9:modifybook();
562 | break;
563 | case 10:deletebook();
564 | break;
565 | case 11:
566 | return;
567 | default:
568 | cout<<"Invalid choice";
569 | }
570 | adminmenu();
571 | }
572 | void main()
573 |
574 | {
575 | char ch;
576 | clrscr();
577 | start();
578 | do{
579 | clrscr();
580 | cout<<"\n\n\n\t MAIN MENU";
581 | cout<<"\n\n\n\t1 BOOK ISSUE";
582 | cout<<"\n\n\n\t2 BOOK DEPOSIT";
583 | cout<<"\n\n\n\t3 ADMINISTRATOR MENU";
584 | cout<<"\n\n\n\t4 EXIT";
585 | cout<<"\n\n\n\t PLEASE SELECT YOUR OPTION(1-4)";
586 | ch=getche();
587 | switch(ch)
588 | { case '1': bookissue();
589 | break;
590 | case '2': bookdeposit();
591 | break;
592 | case '3':
593 | adminmenu();
594 | break;
595 | case '4':
596 | exit(0);
597 | break;
598 | default:
599 | cout<<"INVALID CHOICE";
600 |
601 | }
602 | }while(ch!=4 );
603 |
604 | }
--------------------------------------------------------------------------------