C/C++ Projects

Library Management System In C++ With Source Code

Project: Library Management System

– To download Library Management System project for free (scroll down)

About Project

Library Management System is based on a concept of recording owned books, issued books, returned books, students who have borrowed and many more. Before stepping into the main system a user has to pass through a login system to get access, there are two types of login i.e Student and Librarian Login. To get access to the Librarian’s account, a password should be provided for the Librarian only. There are many features in this project. The user can also change the password from the system for their own security.

Talking about the features of the Library Management System, after logging in as a student he/she can only view booklists. All the system is controlled by the librarian as he/she can view, search, modify, add, delete books, and Issue books. The other main feature contains re-issue books and returns book. The user can also search students who issued books from the library. While adding books, he/she has to provide the details which includes the book, author and publication’s name, book Id, price, and quantity. Similarly, if a user wants to issue books for a few days, he can easily issue just by providing book’s name, id, student’s name with Id, the issued date and if the user wants to re-issue book then he/she has to provide student’s id, book id, and new date. The user can add books easily as it is separated by different categories.

While returning the book, if a user returns late then the system automatically charges fine depending upon issued dates. Another feature is that the user can change the password easily from the system. The librarian login works as the admin panel in this system. Library Management system is developed using C++ Programming Language and different variables, strings have been used for the development of it. Library Management System in C++ Programming is free to download with source code. This project provides the best system for managing library records.

In order to run the project, you must have installed Dev C++ or Code Blocks on your PC. (we recommend these IDE). For the project demo, have a look at the video below.

Features:

  1. Login System
  2. Login options
  3. Books branch
  4. Add, modify, view and delete books
  5. Issue book
  6. Re-issue book
  7. Return book
  8. Change password
  9. Fine charging system
LOGIN DETAILS ARE PROVIDED IN “Readme.txt” FILE INSIDE PROJECT FOLDER

DOWNLOAD LIBRARY MANAGEMENT SYSTEM IN C++ WITH SOURCE CODE: CLICK THE BUTTON BELOW


This Post Has 11 Comments

  1. carl Reply

    hi,i just downloaded the library management system and noticed that anytime i input the password it tells me “wrong password” ive used the password provided while downloading it..what migh be the issue and is there a way to fix it?

  2. san Reply

    how to copy source code in c programming please tell me

  3. san Reply

    how to copy coding in c programming

  4. shivam Reply

    hi, when i am entering my choice no.2 as an libararyn so it is showing segmentaion fault (core dump). what should i do? please help me out

  5. Sandeep Kumar Reply

    stbno[0]=’/0′; means in library code

  6. Muhamad Arifuddin Bin Kamarudin Reply

    #include
    #include
    #include
    #include

    using namespace std;

    class Patron; // forward declaration;

    class Book {
    public:
    Book() {
    patron = 0;
    }
    bool operator== (const Book& bk) const {
    return strcmp(title,bk.title) == 0;
    }
    private:
    char *title;
    Patron *patron;
    ostream& printBook(ostream&) const;
    friend ostream& operator<< (ostream& out, const Book& bk) {
    return bk.printBook(out);
    }
    friend class CheckedOutBook;
    friend Patron;
    friend void includeBook();
    friend void checkOutBook();
    friend void returnBook();
    };

    class Author {
    public:
    Author() {
    }
    bool operator== (const Author& ar) const {
    return strcmp(name,ar.name) == 0;
    }
    private:
    char *name;
    list books;
    ostream& printAuthor(ostream&) const;
    friend ostream& operator<< (ostream& out,const Author& ar) {
    return ar.printAuthor(out);
    }
    friend void includeBook();
    friend void checkOutBook();
    friend void returnBook();
    friend class CheckedOutBook;
    friend Patron;
    };

    class CheckedOutBook {
    public:
    CheckedOutBook(list::iterator ar = 0,
    list::iterator bk = 0) {
    author = ar;
    book = bk;
    }
    bool operator== (const CheckedOutBook& bk) const {
    return strcmp(author->name,bk.author->name) == 0 &&
    strcmp(book->title,bk.book->title) == 0;
    }
    private:
    list::iterator author;
    list::iterator book;
    friend void checkOutBook();
    friend void returnBook();
    friend Patron;
    };

    class Patron {
    public:
    Patron() {
    }
    bool operator== (const Patron& pn) const {
    return strcmp(name,pn.name) == 0;
    }
    private:
    char *name;
    list books;
    ostream& printPatron(ostream&) const;
    friend ostream& operator<< (ostream& out, const Patron& pn) {
    return pn.printPatron(out);
    }
    friend void checkOutBook();
    friend void returnBook();
    friend Book;
    };

    list catalog[‘Z’+1];
    list people[‘Z’+1];

    ostream& Author::printAuthor(ostream& out) const {
    out << name << endl;
    list::const_iterator ref = books.begin();
    for ( ; ref != books.end(); ref++)
    out << *ref; // overloaded <<
    return out;
    }

    ostream& Book::printBook(ostream& out) const {
    out << " * " << title;
    if (patron != 0)
    out << " – checked out to " <name; // overloaded <<
    out << endl;
    return out;
    }

    ostream& Patron::printPatron(ostream& out) const {
    out << name;
    if (!books.empty()) {
    out << " has the following books:\n";
    list::const_iterator bk = books.begin();
    for ( ; bk != books.end(); bk++)
    out << " * " <author->name << ", "
    <book->title << endl;
    }
    else out << " has no books\n";
    return out;
    }

    template
    ostream& operator<< (ostream& out, const list& lst) {
    for (list::const_iterator ref = lst.begin(); ref != lst.end(); ref++)
    out << *ref; // overloaded <<
    return out;
    }

    char* getString(char *msg) {
    char s[82], i, *destin;
    cout << msg;
    cin.get(s,80);
    while (cin.get(s[81]) && s[81] != '\n'); // discard overflowing
    destin = new char[strlen(s)+1]; // characters;
    for (i = 0; destin[i] = toupper(s[i]); i++);
    return destin;
    }

    void status() {
    register int i;
    cout << "Library has the following books:\n\n";
    for (i = 'A'; i <= 'Z'; i++)
    if (!catalog[i].empty())
    cout << catalog[i];
    cout << "\nThe following people are using the library:\n\n";
    for (i = 'A'; i <= 'Z'; i++)
    if (!people[i].empty())
    cout << people[i];
    }

    void includeBook() {
    Author newAuthor;
    Book newBook;
    newAuthor.name = getString("Enter author's name: ");
    newBook.title = getString("Enter the title of the book: ");
    list::iterator oldAuthor =
    find(catalog[newAuthor.name[0]].begin(),
    catalog[newAuthor.name[0]].end(),newAuthor);
    if (oldAuthor == catalog[newAuthor.name[0]].end()) {
    newAuthor.books.push_front(newBook);
    catalog[newAuthor.name[0]].push_front(newAuthor);
    }
    else (*oldAuthor).books.push_front(newBook);
    }

    void checkOutBook() {
    Patron patron;
    Author author;
    Book book;
    list::iterator authorRef;
    list::iterator bookRef;
    patron.name = getString(“Enter patron’s name: “);
    while (true) {
    author.name = getString(“Enter author’s name: “);
    authorRef = find(catalog[author.name[0]].begin(),
    catalog[author.name[0]].end(),author);
    if (authorRef == catalog[author.name[0]].end())
    cout << "Misspelled author's name\n";
    else break;
    }
    while (true) {
    book.title = getString("Enter the title of the book: ");
    bookRef = find((*authorRef).books.begin(),
    (*authorRef).books.end(),book);
    if (bookRef == (*authorRef).books.end())
    cout << "Misspelled title\n";
    else break;
    }
    list::iterator patronRef;
    patronRef = find(people[patron.name[0]].begin(),
    people[patron.name[0]].end(),patron);
    CheckedOutBook checkedOutBook(authorRef,bookRef);
    if (patronRef == people[patron.name[0]].end()) { // a new patron
    patron.books.push_front(checkedOutBook); // in the library;
    people[patron.name[0]].push_front(patron);
    (*bookRef).patron = &*people[patron.name[0]].begin();
    }
    else {
    (*patronRef).books.push_front(checkedOutBook);
    (*bookRef).patron = &*patronRef;
    }
    }

    void returnBook() {
    Patron patron;
    Book book;
    Author author;
    list::iterator patronRef;
    list::iterator bookRef;
    list::iterator authorRef;
    while (true) {
    patron.name = getString(“Enter patron’s name: “);
    patronRef = find(people[patron.name[0]].begin(),
    people[patron.name[0]].end(),patron);
    if (patronRef == people[patron.name[0]].end())
    cout << "Patron's name misspelled\n";
    else break;
    }
    while (true) {
    author.name = getString("Enter author's name: ");
    authorRef = find(catalog[author.name[0]].begin(),
    catalog[author.name[0]].end(),author);
    if (authorRef == catalog[author.name[0]].end())
    cout << "Misspelled author's name\n";
    else break;
    }
    while (true) {
    book.title = getString("Enter the title of the book: ");
    bookRef = find((*authorRef).books.begin(),
    (*authorRef).books.end(),book);
    if (bookRef == (*authorRef).books.end())
    cout << "Misspelled title\n";
    else break;
    }
    CheckedOutBook checkedOutBook(authorRef,bookRef);
    (*bookRef).patron = 0;
    (*patronRef).books.remove(checkedOutBook);
    }

    int menu() {
    int option;
    cout << "\nEnter one of the following options:\n"
    << "1. Include a book in the catalog\n2. Check out a book\n"
    << "3. Return a book\n4. Status\n5. Exit\n"
    <> option;
    cin.get(); // discard ‘\n’;
    return option;
    }

    int main() {
    while (true)
    switch (menu()) {
    case 1: includeBook(); break;
    case 2: checkOutBook(); break;
    case 3: returnBook(); break;
    case 4: status(); break;
    case 5: return 0;
    default: cout << "Wrong option, try again: ";
    }
    return 0;
    }

    *Can anyone fix this code for me, i hope fix ASAP. TQ

  7. Monalisa prusty Reply

    Please kindly mail me this library project code .

  8. Chirag Madan Reply

    A very in-depth project indeed. Helped me a lot. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *