Library management project in C++ with Output and Source Code | Projects in C++

Library management is something to maintain the rules and regulations of the library because the library contains large source of information. So we will make a library management Project in C++.

Library Management:

The library is actually a source of information sources and it includes books, newspapers and so on. So we need some people to manage the system of the library which includes the librarian also.

Library Management Project in C++:

So we make a library management project in C++ and it basically a simple project in C++.
And we will perform the hole task with the help of using loops, if and else and character arrays.
Library management project in C++ with Output and Source Code | Projects in C++
Library management project in C++ with Output and Source Code | Projects in C++

Goals in this C++ Projects.

So we will make a very basic and simple library management project in C++ and keep in mind the following goals.

  • Record the data of books.
  • Delete the record of books.
  • Assign books to a person.
  • Get a book back from a person.

Details of C++ Project:

If a person wants to get a book we will take the following information:

Record the data of books:
  • Get the IBAN number.
  • Get publishing a year.
  • Get information about the edition of the book.
  • Quantity of Books.
Delete the record of books:

we will take the same information as described above.

and similarly to assign a book and get back a book in library management project in C++.

Library management project in C++ with Output and Source Code | Projects in C++
Library management project in C++ with Output and Source Code | Projects in C++



The Code of library management project in C++:

/*

#include<iostream>

using namespace std;
int main()
{
bool flag = false, idel = false, ibn = false, ibn2 = false;
const int s = 5;
int iban[s] = { 0 }, p_year[s] = { 0 }, edition[s] = { 0 }, year[s] = { 0 }, quantity[s] = { 0 }, price[s] = { 0 }, count = 0;
int choice = 0, i = 0, k = 0, j = 0, ibannumber = 0, rnumber[100] = { 0 }, age[100] = { 0 }, deletec[s] = { 0 }, price2[s] = { 0 };
int tem = 0, count2 = 0;
char gender[10] = { '\0' }, type = '\0';
//loop for general
for (j = 0; j < s; j++)
{
//loop for the user input tasks

for (i = 0; i < s; i++)
{
cout << "**********************************************************" << endl;
cout << "please enter 1 to record the data of books :" << endl;
cout << "please enter 2 to delete the book record : " << endl;
cout << "please enter 3 to assign book to a person :" << endl;
cout << "please enter 4 to get back book from a person" << endl;
cin >> choice;
cout << "**********************************************************" << endl;
//choice 1
if (choice == 1)
{
cout << "**********************************************************" << endl;
cout << "please enter IBAN number :\t";
cin >> iban[i];
cout << "please enter publishing year :""\t";
cin >> p_year[i];
cout << "please enter edition :\t";
cin >> edition[i];
cout << "please enter price :\t";
cin >> price[i];
cout << "please enter quantity : \t";
cin >> quantity[i];
count = count + quantity[i];
cout << "the data has been sucessfully saved:\t" << endl;
cout << "iban number    publishing year           edition        price       quantity " << "\t" << endl;
cout << iban[i] << "          " << "          " << p_year[i] << "                   " << edition[i] << "         " << price[i] << "          " << quantity[i] << "\t" << endl;
cout << "the totals number of books= " << count << endl;
cout << "**********************************************************" << endl;

}
//choice 2
if (choice == 2)
{
cout << "**********************************************************" << endl;
cout << "please enter the IBAN number of book to delete its record :";
cin >> ibannumber;
cout << "**********************************************************" << endl;
for (k = 0; k < s; k++)
{
if (iban[k] == ibannumber&&quantity[k]>1)
{
cout << "**********************************************************" << endl;
cout << "how many copies of book you want to delete :";
cin >> deletec[k];
count = count - deletec[k];
flag = false;
break;
cout << "**********************************************************" << endl;
}
else
{
flag = true;
}

}
if (flag == false)
{
cout << "**********************************************************" << endl;
cout << "the new record of books=" << count << endl;
cout << "**********************************************************" << endl;
}
else
{
cout << "**********************************************************" << endl;
cout << "the IBAN number is not found" << endl;
cout << "**********************************************************" << endl;
}
//condition for to delete specific iban number
if (quantity[k] == deletec[k])
{
if (iban[k] == ibannumber)
{
for (int l = k; l < s; l++)
{
iban[l] = iban[l + 1];
iban[s] = 0;
idel = false;
break;
}
}
else
{
idel = true;
break;
}
}
if (idel == false)
{
cout << "**********************************************************" << endl;
cout << "the perticular IBAN is deleted" << endl;
cout << "**********************************************************" << endl;
}
else
{
cout << "***************************************************************" << endl;
cout << "the perticular IBAN is not deleted and book is till in library" << endl;
cout << "*************************************************************" << endl;
}
}
//choice 3
if (choice == 3)
{
if (count > 1)
{
cout << "please enter the type:";
cin >> type;
if (type == 's' || type == 'S' || type == 'T' || type == 't')
{
cout << "**********************************************************" << endl;
cout << "please enter the age:";
cin >> age[i];
cout << "please enter the gender :";
cin >> gender;
cout << "please enter the roll number  :";
cin >> rnumber[i];
cout << "**********************************************************" << endl;
for (int j = 0; j < s; j++)
{
cout << "**********************************************************" << endl;
cout << "please enter the iban number :";
cin >> iban[i];
cout << "**********************************************************" << endl;
if (iban[j] == iban[i])
{
ibn = false;
break;
}
else
{
ibn = true;
break;
}
}
if (ibn == false)
{
cout << "**********************************************************" << endl;
cout << "please enter how many copies you want to delete" << endl;
cin >> deletec[i];
count = count - deletec[i];
cout << "the book is given to person  which have following characteristics " << endl;
cout << "age         gender          rnumber        iban number" << endl;
cout << age[i] << "     " << "     " << gender << "     " << "       " << rnumber[i] << "      " << iban[i] << endl;
cout << "the totals numbers of remaining books =" << count << endl;
cout << "**********************************************************" << endl;
}
else
{
cout << "**********************************************************" << endl;
cout << "the iban number is not found" << endl;
cout << "**********************************************************" << endl;
}

}
}
else
{
cout << "**********************************************************" << endl;
cout << "there is no more book is assign to a person" << endl;
cout << "**********************************************************" << endl;
}
}
//choice 4
if (choice == 4)
{
cout << "**********************************************************" << endl;
cout << "please enter the type:";
cin >> type;
cout << "**********************************************************" << endl;
if (type == 's' || type == 'S' || type == 'T' || type == 't')
{
cout << "**********************************************************" << endl;
cout << "please enter the age:";
cin >> age[i];
cout << "please enter the gender :";
cin >> gender;
cout << "please enter the roll number  :";
cin >> rnumber[i];
for (int j = 0; j < s; j++)
{
cout << "please enter the iban number :";
cin >> iban[i];
cout << "**********************************************************" << endl;
if (iban[j] == iban[i])
{
ibn2 = false;
break;
}
else
{
ibn2 = true;
break;
}
}
if (ibn2 == false)
{
cout << "**********************************************************" << endl;
cout << "please enter how many copies you want to submit" << endl;
cin >> deletec[i];
count = count - deletec[i];
cout << "the book is get bact from a person  which have following characteristics " << endl;
cout << "age         gender          rnumber        iban number" << endl;
cout << age[i] << "     " << "     " << gender << "     " << "       " << rnumber[i] << "      " << iban[i] << endl;
cout << "the totals numbers of remaining books =" << count << endl;
cout << "**********************************************************" << endl;
}
else
{
cout << "**********************************************************" << endl;
cout << "the iban number is not found" << endl;
cout << "**********************************************************" << endl;
}
}
else
{
cout << "**********************************************************" << endl;
cout << "please enter the specific charater" << endl;
cout << "**********************************************************" << endl;
}
}
//choice 5
if (choice == 5)
{
for (i = 0; i < s; i++)
{
for (j = i + 1; j < s; j++)
{
if (price[i] < price[j])
{
swap(price[i], price[j]);
swap(iban[i], iban[j]);
swap(quantity[i], quantity[j]);
swap(p_year[i], p_year[j]);
swap(edition[i], edition[j]);
count2++;
}
}
}
}
}
}

cout << "the sorting according to price =" << endl;
for (int j = 0; j < count2; j++)
{
cout << "**********************************************************" << endl;
cout << "price    :" << price[j] << "," << endl;
cout << "quantity    :" << quantity[j] << "," << endl;
cout << "ibannumber    :" << iban[j] << "," << endl;
cout << "publishing year    :" << p_year[j] << "," << endl;
cout << "edition" << edition[j] << "," << endl;
cout << "**********************************************************" << endl;
}
cout << endl;
system("pause");
return 0;
}
*/
Library-management-project-in-C++-with-Output-and-Source-Code -Projects-in-C++
Library-management-project-in-C++-with-Output-and-Source-Code -Projects-in-C++

Conclusion:

So we conclude that the Library management project in C++ is very easy and it is a Basic project in C++ also.



[So if you have any suggestions related to this post o Project then please let me know on the comment box.]
Best Regards,
Bilal Ahmad.

And Special Thanks to "Mohsin Ali Irfan".

2 comments:

Please tell me if you have any suggestions related to these projects.
thanks

Powered by Blogger.