├── README.md ├── LICENSE └── app.cpp /README.md: -------------------------------------------------------------------------------- 1 | ##C++ Library Management System 2 | 3 | Source Code for C++ Library Management System Applying OOP Concepts 4 | 5 | Playlist link: https://www.youtube.com/playlist?list=PL9BEhEeCPDbbtF3exuFP92nME9a0O93Bh 6 | 7 | My Youtube Channel: [markbirds](https://www.youtube.com/channel/UCoTHZEIuf_LuQs24--uRHUg) 8 | 9 | --- 10 | 11 | ![interface](https://i.ibb.co/k4WFftL/Capture.jpg) 12 | 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Owen Patrick Falculan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /app.cpp: -------------------------------------------------------------------------------- 1 | //Library Management System applying OOP concepts 2 | //OOP Concepts applied: Classes and Objects,Access Specifiers,Encapsulation 3 | 4 | //Libraries 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | 11 | class Book { 12 | private: 13 | string isbn,title,author,edition,publication; //private variables 14 | public: 15 | //setters - assigning user value to private variables 16 | void setIsbn(string a){isbn = a;} 17 | void setTitle(string b){title = b;} 18 | void setAuthor(string c){author = c;} 19 | void setEdition(string d){edition = d;} 20 | void setPublication(string e){publication = e;} 21 | //getters - getting the values from private variables 22 | string getIsbn(){return isbn;} 23 | string getTitle(){return title;} 24 | string getAuthor(){return author;} 25 | string getEdition(){return edition;} 26 | string getPublication(){return publication;} 27 | }; 28 | 29 | //initializing functions with counter as parameter 30 | void addBook(int counter); 31 | void deleteBook(int counter); 32 | void editBook(int counter); 33 | void searchBook(int counter); 34 | void viewAllBooks(int counter); 35 | void quit(); 36 | 37 | //counter for Book array 38 | int counter=0; 39 | 40 | //function for incrementing counter 41 | void increment(int a){ 42 | a++; 43 | counter=a; 44 | } 45 | 46 | //function for decrementing counter 47 | void decrement(int a){ 48 | a--; 49 | counter=a; 50 | } 51 | 52 | //Book class array initialization 53 | Book books[10]; 54 | 55 | //main function 56 | int main(){ 57 | string choice; 58 | //Main Menu 59 | system("CLS"); 60 | cout<<"LIBRARY MANAGEMENT SYSTEM\n\n"; 61 | cout<<"[1]ADD BOOK\n"; 62 | cout<<"[2]DELETE BOOK\n"; 63 | cout<<"[3]EDIT BOOK\n"; 64 | cout<<"[4]SEARCH BOOK\n"; 65 | cout<<"[5]VIEW ALL BOOKS\n"; 66 | cout<<"[6]QUIT\n\n"; 67 | 68 | cout<<"ENTER CHOICE: "; 69 | getline(cin,choice); 70 | system("CLS"); 71 | 72 | if(choice=="1"){ 73 | addBook(counter); //function call 74 | } 75 | else if(choice=="2"){ 76 | deleteBook(counter); //function call 77 | } 78 | else if(choice=="3"){ 79 | editBook(counter); //function call 80 | } 81 | else if(choice=="4"){ 82 | searchBook(counter); //function call 83 | } 84 | else if(choice=="5"){ 85 | viewAllBooks(counter); //function call 86 | } 87 | else if(choice=="6"){ 88 | quit(); //function call 89 | } 90 | else{ 91 | main(); //function call to self(main) 92 | } 93 | 94 | _getch(); 95 | return 0; 96 | } 97 | 98 | 99 | //addBook function 100 | void addBook(int counter){ 101 | string isbn,title,author,edition,publication; 102 | cout<<"ADD BOOK\n\n"; 103 | if(counter<10){ 104 | cout<<"Enter ISBN: "; 105 | getline(cin,isbn); //getline - just like cin but includes white spaces 106 | cout<<"Enter Title: "; 107 | getline(cin,title); 108 | cout<<"Enter Author: "; 109 | getline(cin,author); 110 | cout<<"Enter Edition: "; 111 | getline(cin,edition); 112 | cout<<"Enter Publication: "; 113 | getline(cin,publication); 114 | books[counter].setIsbn(isbn); //assigning the values entered to book object 115 | books[counter].setTitle(title); 116 | books[counter].setAuthor(author); 117 | books[counter].setEdition(edition); 118 | books[counter].setPublication(publication); 119 | increment(counter); //calling function to increment counter 120 | cout<<"\nBOOK ADDED SUCCESSFULLY!\n\nPress any key to continue . . ."; 121 | _getch(); 122 | main(); 123 | } 124 | else{ 125 | cout<<"YOU HAVE REACHED THE MAXIMUM NUMBER OF BOOKS TOBE ADDED!\n\nPress any key to continue . . ."; 126 | _getch(); 127 | main(); 128 | } 129 | } 130 | 131 | //deleteBook function 132 | void deleteBook(int counter){ 133 | string isbn; 134 | int choice; 135 | cout<<"DELETE BOOK\n\n"; 136 | if(counter==0){ 137 | cout<<"THERE IS NO BOOK TO DELETE!\n\nPress any key to continue . . ."; 138 | _getch(); 139 | main(); 140 | } 141 | cout<<"Enter ISBN: "; 142 | getline(cin,isbn); 143 | 144 | for(int i=0;i>choice; 150 | if(choice==1){ 151 | books[i].setIsbn(""); //setting the value to none 152 | books[i].setTitle(""); 153 | books[i].setAuthor(""); 154 | books[i].setEdition(""); 155 | books[i].setPublication(""); 156 | for(int a=i;a