Source code OF LIBRARY MANAGEMENT SYSTEM Project in C++ – Free Download.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
#include<iostream.h> #include<constream.h> #include<stdlib.h> #include<graphics.h> #include<dos.h> int n,n1; int i; int inc=0; int inc1=0; class book { public: int bookcode; char bookname[20]; char authorname[20]; char bookpub[20]; int bookprice; int status; public: void addbook() { clrscr(); status=1; cout<<"\t\t\t YOU HAVE CHOSEN TO ADD BOOK DETAILS"<<endl; cout<<"\t\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl; cout<<endl; inc++; bookcode=100+inc; cout<<"\n\tBook code :"<<bookcode; cout<<endl; cout<<"\n\tEnter book name :"; cin>>bookname; cout<<"\n\tEnter author name :"; cin>>authorname; cout<<"\n\tEnter publishing company :"; cin>>bookpub; cout<<"\n\tEnter book price :"; cin>>bookprice; } void dispbook() { cout<<bookcode<<"\t\t"<<bookname<<"\t\t"<<authorname<<"\t\t"<<bookpub<<"\t\t"<<bookprice<<endl; } void liststat() { if(status==1) { cout<<"\t\tBookcode:"<<bookcode<<"\t\tStatus:Available"<<endl; cout<<endl; } else { cout<<"\t\tBookcode:"<<bookcode<<"\t\tStatus:Issued"<<endl; cout<<endl; } } };book b[10]; class student { public: int studid; char studname[20]; char deptname[20]; int bookcount; public: void addstud() { clrscr(); cout<<"\t\tYOU HAVE CHOSEN TO ADD STUDENT DETAILS"<<endl; cout<<"\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl; cout<<endl; cout<<endl; inc1++; studid=100+inc1; cout<<"\t\tStudent Id :"<<studid; cout<<endl; cout<<endl; cout<<"\t\tEnter Student Name :"; cin>>studname; cout<<endl; cout<<"\t\tEnter Department Name :"; cin>>deptname; cout<<endl; bookcount=2; cout<<endl; cout<<"\t\tMaximum books allowed for a student:"<<bookcount<<endl; cout<<endl; } void dispstud() { cout<<"\t"<<studid<<"\t\t"<<studname<<"\t\t"<<deptname<<endl; //bookcount=2; cout<<endl; } };student s[10]; class issue { public: int day,month,year; int day2,month2,year2; int iday,imon,iyear; int rday,rmon,ryear; int eday,emon,eyear; int yr1,yr2,m1,m2,d1,d2,mons1,mons2,mons,days,yrs,sum,j; int loop; int fine; public: void isdatecalc() { cout<<"\t\tEnter day:"; cin>>day; cout<<"\t\tEnter month:"; cin>>month; cout<<"\t\tEnter year:"; cin>>year; day2=day; month2=month; year2=year; day2=day2+20; if(((month2==1)||(month2==3)||(month2==5)||(month2==7)||(month2==8)||(month2==10)||(month2==12))&&((day2>31))) { day2=day2-31; month2=month2+1; if(month2==13) { year2++; month2=1; } } else if(((month2==4)||(month2==6)||(month2==9)||(month2==11))&&((day2>30))) { day2-=30; month2++; } else if(((year2%4==0)||(year2%400==0))&&(day2>29)&&(month==2)) { day2-=29; month2++; } else if(((year2%4!=0)||(year2%100!=0)||(year2%400!=0))&&(day2>28)&&(month2==2)) { day2-=28; month2++; } cout<<endl; } void isdate() { iday=day; imon=month; iyear=year; cout<<"\t\tIssued date:"<<iday<<"/"<<imon<<"/"<<iyear; cout<<endl; } void retdate() { rday=day2; rmon=month2; ryear=year2; cout<<"\t\tReturn Date:"<<rday<<"/"<<rmon<<"/"<<ryear<<endl; cout<<endl; } void edatecalc() { eday=rday; emon=rmon; eyear=ryear; eday=eday+20; if(((emon==1)||(emon==3)||(emon==5)||(emon==7)||(emon==8)||(emon==10)||(emon==12))&&((eday>31))) { eday=eday-31; emon=emon+1; if(emon==13) { eyear++; emon=1; } } else if(((emon==4)||(emon==6)||(emon==9)||(emon==11))&&((eday>30))) { eday-=30; emon++; } else if(((eyear%4==0)||(eyear%100==0)||(eyear%400==0))&&(eday>29)&&(emon==2)) { eday-=29; emon++; } else if(((eyear%4!=0)||(eyear%100!=0)||(eyear%400!=0))&&(eday>28)&&(emon==2)) { eday-=28; emon++; } cout<<endl; cout<<endl; cout<<"\t\tYour extended due date is:"<<eday<<"/"<<emon<<"/"<<eyear<<endl; } void finecalc(); }; issue is; void issue::finecalc() { int mon[]={31,28,31,30,31,30,31,31,30,31,30,31}; loop=365; sum=0; d1=rday; m1=rmon; yr1=ryear; cout<<endl; cout<<"\t\tYour actual return Date Is: "<<d1<<"/"<<m1<<"/"<<yr1<<endl; cout<<endl; cout<<"\t\tEnter the date of return below.."<<endl; cout<<endl; cout<<"\t\tEnter day:"; cin>>d2; cout<<endl; cout<<"\t\tEnter month:"; cin>>m2; cout<<endl; cout<<"\t\tEnter year:"; cin>>yr2; cout<<endl; days=d2-d1; yrs=yr2-yr1; if(m2>=m1) { mons=m1-m2; mons2=abs(mons); } else { mons=m2-m1; mons2=abs(mons); } sum=yrs*loop+mons+days+mons2; if(m2>m1) { j=m1; } else { j=m2; } if(mons2!=0) { for(i=0;i<mons2;i++) { sum=sum+mon[j]; j++; } } cout<<endl; cout<<"\t\tYour date of return:"<<d2<<"/"<<m2<<"/"<<yr2<<endl; cout<<endl; fine=(sum+mons)*1; if((yr1%4==0)||(yr1%400==0)&&(m1==2)) { fine=fine+1; } /* if((m1==2)&&(yr1%4!=0)||(yr1%400!=0)) { fine=fine-1; }*/ cout<<"\t\t\tFine amount:Rs."<<fine<<endl; cout<<"\t\t\t*****************"<<endl; } void main() { int ch,i; char ch2,ch3,ch4; int sbookcode,sstudid; int flag,flag1,pos,spos,ipos; int sflag,stpos; int ibookcode,istudid; int rbookcode,rstudid; int rflag1,rflag2; int rpos1,rpos2,l; do { clrscr(); textcolor(15); textbackground(4); cout<<"\t\t\t********%%%%%%%%%%********"<<endl; cout<<"\t\t\tLIBRARY MANAGEMENT SYSTEM"<<endl; cout<<"\t\t\t********%%%%%%%%%%********"<<endl; cout<<endl; cout<<"\t\t\t\tMAINMENU"<<endl; cout<<"\t\t\t\t^^^^^^^^"<<endl; cout<<endl; cout<<"\t\t ##############################################"<<endl; cout<<endl; cout<<"\t\t$ \t1. TAKE A TOUR OF THE PROJECT. \t$"<<endl; cout<<"\t\t$ \t2. ADD NEW BOOK. \t$"<<endl; cout<<"\t\t$ \t3. VIEW ALL BOOK DETAILS. \t$"<<endl; cout<<"\t\t$ \t4. SEARCH A BOOK. \t$"<<endl; cout<<"\t\t$ \t5. ADD NEW STUDENT. \t$"<<endl; cout<<"\t\t$ \t6. DISPLAY ALL STUDENT DETAILS. \t$"<<endl; cout<<"\t\t$ \t7. VIEW A STUDENT. \t$"<<endl; cout<<"\t\t$ \t8. ISSUE BOOK. \t$"<<endl; cout<<"\t\t$ \t9. RETURN BOOK. \t$"<<endl; cout<<"\t\t$ \t0. EXIT. \t$"<<endl; cout<<endl; cout<<"\t\t ##############################################"<<endl; cout<<endl; cout<<"\t\t\t\tHit your choice:"; cin>>ch; switch(ch) { case 1:clrscr(); int d,m; d=DETECT; initgraph(&d,&m," "); cleardevice(); for(int g=440;g>=-250;g--) { cleardevice(); setcolor(5); outtextxy(250,g,"WELCOME TO"); outtextxy(230,g+20,"LIBRARY MANAGEMENT"); outtextxy(260,g+40,"SYSTEM"); setcolor(6); outtextxy(250,g+100,"MADE BY"); outtextxy(250,g+120,"*******"); outtextxy(180,g+140,"NARMADHA.S.T"); setcolor(3); setcolor(12); setbkcolor(14); settextstyle(7,0,5); outtextxy(250,g+250,"THANK YOU"); delay(20); } cleardevice(); cout<<endl; cout<<endl; cout<<"\t The Project Library Management System contains three "<<endl; cout<<"\t different modules."<<endl; cout<<endl; cout<<"\t We can add new books,see the list of added books,"<<endl; cout<<"\t search a particular book."<<endl; cout<<endl; cout<<"\t Similarly, we can add new students, view the list of"<<endl; cout<<"\t all added students with their course details and view"<<endl; cout<<"\t a single student."<<endl; cout<<endl; cout<<"\t The main module in the project is the issue-return module."<<endl; cout<<endl; cout<<"\t We can issue only two books to a student.The issued period"<<endl; cout<<"\t is for twenty days.So within twenty days, the student should"<<endl; cout<<"\t return the book or can extend further for a period of twenty"<<endl; cout<<"\t days.If neither returned nor extended,a fine of Re.1/day is"<<endl; cout<<"\t collected on the day of return."<<endl; cout<<endl<<endl; cout<<"\t\t\t\t THANK YOU"<<endl; cout<<endl; cout<<"\t\t\t\t Narmadha.S.T"<<endl; cout<<endl; cout<<endl; cout<<"\t\t\t<<-----BACK TO MAIN MENU-----"<<endl; getch(); closegraph(); main(); getch(); break; case 2:clrscr(); cout<<"\t\tYOU HAVE CHOSEN TO ADD BOOK DETAILS"<<endl; cout<<"\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl; cout<<endl; cout<<endl; cout<<"\t\tEnter number of books to be added:"; cin>>n; for(i=1;i<=n;i++) { cout<<"Enter book code:"<<100+i; b[i].addbook(); } cout<<endl; cout<<endl; cout<<"\t\t<<-----Back To Main Menu-----"<<endl; getch(); main(); break; case 3:clrscr(); cout<<"\t\t\tLIST OF ALL ADDED BOOKS"<<endl; cout<<"\t\t\t^^^^^^^^^^^^^^^^^^^^^^^"<<endl; cout<<endl; cout<<"**********************************************************************"<<endl; cout<<"BOOKCODE\tBOOKNAME\tAUTHORNAME\tPUB.COMPANY\tPRICE"<<endl; cout<<"**********************************************************************"<<endl; for(i=1;i<=n;i++) { b[i].dispbook(); } cout<<endl; cout<<endl; for(i=1;i<=n;i++) { b[i].liststat(); } cout<<endl; cout<<"\t\t<<-----Back To Main Menu-----"<<endl; getch(); main(); break; case 4:clrscr(); cout<<"\t\t\tSEARCH A BOOK"<<endl; cout<<"\t\t\t^^^^^^^^^^^^^^"<<endl; cout<<endl; cout<<"\t\tEnter book code to search:"; cin>>sbookcode; for(i=1;i<=n;i++) { if(sbookcode==b[i].bookcode) { flag=1; pos=i; } } if(flag==1) { cout<<endl; cout<<"\t\tBook is available!!"<<endl; cout<<endl; cout<<"\t\tTHE BOOK DETAILS ARE..."<<endl; cout<<endl; cout<<"\t\tBook code :"<<b[pos].bookcode<<endl; cout<<"\t\tBook name :"<<b[pos].bookname<<endl; cout<<"\t\tAuthor name :"<<b[pos].authorname<<endl; cout<<"\t\tPublishing company :"<<b[pos].bookpub<<endl; cout<<"\t\tBook price :"<<b[pos].bookprice<<endl; } else { cout<<endl; cout<<"\t\tSorry!..No Book Exists With Code:"<<sbookcode<<endl; } cout<<endl; cout<<endl; cout<<"\t\t"<<"<<-----Back To Main Menu-----"<<endl; getch(); main(); break; case 5:clrscr(); cout<<"\t\tYOU HAVE CHOSEN TO ADD STUDENT DETAILS"<<endl; cout<<"\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl; cout<<endl; cout<<"\t\tEnter number of students to be added:"; cin>>n1; for(i=1;i<=n1;i++) { s[i].addstud(); } cout<<endl; cout<<"\t\tNumber of newly added students:"<<n1<<endl; cout<<endl; cout<<endl; cout<<"\t\t<<-----Back To Main Menu-----"<<endl; getch(); main(); break; case 6:clrscr(); cout<<"\t\tLIST OF ALL ADDED STUDENTS"<<endl; cout<<"\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl; cout<<endl; cout<<"\t******************************************"<<endl; cout<<"\tSTUDENT ID\tSTUDENT NAME\tDEPT NAME"<<endl; cout<<"\t******************************************"<<endl; for(i=1;i<=n1;i++) { s[i].dispstud(); } cout<<endl; cout<<"\t<<-----Back To Main Menu-----"<<endl; getch(); main(); break; case 7:clrscr(); cout<<"\t\t\tVIEW A STUDENT"<<endl; cout<<"\t\t\t^^^^^^^^^^^^^^"<<endl; cout<<endl; cout<<"\t\tEnter student id to view:"; cin>>sstudid; for(i=1;i<=n1;i++) { if(sstudid==s[i].studid) { sflag=1; stpos=i; } } if(sflag==1) { cout<<endl; cout<<"\t\tStudent found!!"<<endl; cout<<endl; cout<<"\t\tTHE STUDENT DETAILS ARE..."<<endl; cout<<endl; cout<<"\t\tStudent name :"<<s[stpos].studname<<endl; cout<<"\t\tDepartment name :"<<s[stpos].deptname<<endl; } else { cout<<endl; cout<<"\t\tSorry!..No Student found with this id:"<<sstudid<<endl; } cout<<endl; cout<<endl; cout<<"\t\t"<<"<<-----Back To Main Menu-----"<<endl; getch(); main(); break; case 8:clrscr(); cout<<"\t\t YOU HAVE CHOSEN TO ISSUE A BOOK"<<endl; cout<<"\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl; cout<<endl; cout<<"\t\tEnter student id:"; cin>>istudid; for(i=1;i<=n1;i++) { if(istudid==s[i].studid) { flag=1; spos=i; } } if(flag==1) { cout<<"\t\tEnter book code to issue book:"; cin>>ibookcode; for(i=1;i<=n;i++) { if(ibookcode==b[i].bookcode) { flag1=1; ipos=i; } } } cout<<endl; if(flag==1) { if(flag1==1) { if(s[spos].bookcount!=0) { if(b[ipos].status==1) { s[spos].bookcount--; b[ipos].status=0; cout<<"\t\tDate of issue"<<endl; cout<<"\t\t~~~~~~~~~~~~~"<<endl; is.isdatecalc(); is.isdate(); is.retdate(); cout<<"\t\tThis book is now issued...."<<endl; cout<<endl; cout<<"\t\tBooks allowed now:"<<s[spos].bookcount<<endl; cout<<endl; cout<<"\t Student Id\t Student Name\t BookCode"<<endl; cout<<"\t ----------\t ------------\t --------"<<endl; cout<<"\t "<<s[spos].studid<<"\t\t "<<s[spos].studname<<"\t\t "<<b[ipos].bookcode<<endl; } else { cout<<"\t\tSorry!Book already issued.."<<endl; } } else { cout<<"\t\tSorry!.You cannot take more than two books.."<<endl; } } else { cout<<"\t\tSorry!..No Book Exists With Code:"<<ibookcode<<endl; } } else { cout<<"\t\tSorry!..No Student Exists with Id:"<<istudid<<endl; } cout<<endl; cout<<"\t\t<<-----Back To Main Menu-----"<<endl; getch(); main(); break; case 9:clrscr(); cout<<"\t\tYOU HAVE CHOSEN TO RETURN A BOOK"<<endl; cout<<"\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl; cout<<endl; cout<<"\t\tEnter student id:"; cin>>rstudid; cout<<endl; for(i=1;i<=n1;i++) { if(rstudid==s[i].studid) { rflag1=1; rpos1=i; } } if(rflag1==1) { cout<<"\t\tEnter book code to return book:"; cin>>rbookcode; cout<<endl; for(i=1;i<=n;i++) { if(rbookcode==b[i].bookcode) { rflag2=1; rpos2=i; } } } if(rflag1==1) { if(rflag2==1) { cout<<"\tIs the bookcode:"<<b[rpos2].bookcode<<" issued to student id:"<<s[rpos1].studid<<" ?y/n:"; cin>>ch4; if(ch4=='y') { if(b[rpos2].status==0) { cout<<endl; cout<<"\t\tYou can Return the Book..."<<endl; cout<<endl; is.retdate(); cout<<"\t\tAre you sure you want to return this book ?y/n:"; cin>>ch2; cout<<endl; if(ch2=='y') { cout<<"\t\t Is the book returned before due date?y/n:"; cin>>ch3; cout<<endl; if(ch3=='y') { // is.retdate(); //cout<<endl; cout<<"\t\tBook returned before due date"<<endl; cout<<endl; cout<<"\t\t\tFine - NIL"<<endl; cout<<endl; cout<<"\t\t\t THANK YOU"<<endl; b[rpos2].status=1; s[rpos1].bookcount++; cout<<endl; cout<<"\t\t<<-----Back To Main Menu-----"<<endl; getch(); main(); } else { clrscr(); cout<<endl; cout<<"\t\tYOU HAVE TO PAY FINE !!!"<<endl; is.finecalc(); cout<<endl; b[rpos2].status=1; s[rpos1].bookcount++; cout<<"\t\t<<-----Back To Main Menu-----"<<endl; getch(); main(); } } else { is.retdate(); cout<<endl; cout<<"\t\tYou can extend the book for another twenty days.."<<endl; is.edatecalc(); } } else { cout<<endl; cout<<"\t\tThis Book is not yet issued from library.. "<<endl; } } else { cout<<endl; cout<<"\t\t This book is not issued to you..Sorry!!!"<<endl; } } else { cout<<endl; cout<<"\t\tSorry!..No Book Exists With Code:"<<rbookcode<<endl; } } else { cout<<endl; cout<<"\t\tSorry!..No Student Exists With Id:"<<rstudid<<endl; } cout<<endl; cout<<"\t\t<<-----Back To Main Menu-----"<<endl; getch(); main(); break; case 0:exit(0); default: clrscr(); cout<<"\t\tYou have entered a wrong choice.."<<endl; cout<<"\t\tPlease Re-enter your choice...."<<endl; cout<<endl; cout<<"\t\t\t<<---Go Back---"<<endl; getch(); main(); break; } }while(ch==0); getch(); } |
Free Download Source code OF LIBRARY MANAGEMENT SYSTEM Project in C++ – Free Download
Library Management System Software Documentation
- FUNCTIONAL REQUIREMENTS OF LIBRARY MANAGEMENT SYSTEM
- Non FUNCTIONAL REQUIREMENTS OF LIBRARY MANAGEMENT SYSTEM
- Use Case Diagram of Library Management System
- Class Diagram of Library Management System
- Sequence Diagram of Library Management System
- Entity relationship Diagram of LIBRARY MANAGEMENT SYSTEM ERD
- Use Case Descriptions of LIBRARY MANAGEMENT SYSTEM
- Project MILESTONE, Deliverable, and Risk Management of Library Management System
- Testing of Library Management System with Test Cases