The Music Store Management System Project In C++, it is a console-based program that manages musical records, such as adding new music to the database, modifying music descriptions, and deleting music. All the music records are stored in the database in a well-organized way.
In addition, this C++ Music Store Management System is connected to a MySQL database that has many features that can be helpful to the file structure of music store.
The program can show the total amount of music that has been stored and can search for specific music stored. All data is stored in the MySQL database as the main storage of the system for maintaining all the musical records.
What is Music Store Management System Project in C++?
In C++, Music Store Management System Project is a system designed and created to manage and keep track of all musical records. The program can add new music data, modify music, and delete specific music. It also displays all the music stored in the database.
Furthermore, using the read operation on the console, details including name, kind, category, and artist are efficiently read and stored into database.
Lastly, music has become an inextricable part of our lives. Music is one of the best and most powerful things that can heal a broken heart.
This music shop is not only a simple mini project but also helps customers find the exact songs that they need to relax or to heal pain that they feel in their hearts. This program can handle things in a simple way.
Features Of Music Store Management System
The program has the ability to manage music orders, search music, sell or buy products, find all items, add new items, and remove items from the list.
The following listed below are the features of the Music Store.
- Add or create an order – The user has the right to add or create an order, delete an item, choose an item. All the music bought by the customer can be calculated, and the program can show the total price of the items.
- Search for music – users of the program can search for their music and show the four various categories, such as name, category, type, and artist.
- Sold items – the program displays how many songs and which songs were sold to the customer.
- Availability of the music – the program shows the available songs, which means that it shows the quantity if it is available or not.
- Display all songs – the program shows all the songs in the database record.
- Add new song – The program has the ability to add new song into database.
- Modify or edit songs – the program has the ability to modify songs in the database.
- Delete song – the program has the ability to delete a specific song stored in the database.
- Exit – The program has the ability to exit or stop the program from execution.
Project Details
About Project | Project Details |
---|---|
Project Name : | Music Store Management System Project in C++ |
Project Platform : | C/C++ |
Programming Language Used: | C++ Programming Language |
Developer Name : | itsourcecode.com |
IDE Tool (Recommended): | Codeblocks |
Project Type : | Desktop Application |
Database: | MySQL Database |
Music Store Management System Project Screenshots
The following images below are some parts of the program. Just explore the program in order to know all.
Music Store Management System Source Code
You can copy and paste the source code or else download the complete source code down below.
#include<iostream>
#include<cstdio>
#include<fstream>
#include<sstream>
#include<string>
#include<cstdlib>
#include<conio.h>
#include<windows.h>
#include<mysql.h>
using namespace std;
// Global Variable
int qstate;
MYSQL* conn;
MYSQL_ROW row;
MYSQL_RES* res;
// Global Variable End
class db_response
{
public:
static void ConnectionFunction()
{
conn = mysql_init(0);
if (conn)
{
cout << "Database Connected" << endl;
cout << "Press any key to continue..." << endl;
//getch();
system("cls");
}
else
cout << "Failed To Connect!" << mysql_errno(conn) << endl;
conn = mysql_real_connect(conn, "localhost", "root", "", "musicdb", 0, NULL, 0);
if (conn)
{
cout << "Database Connected To MySql" << conn << endl;
cout << "Press any key to continue..." << endl;
//getch();
system("cls");
}
else
cout << "Failed To Connect!" << mysql_errno(conn) << endl;
}
};
void AddNewItemInDatabase();
void ShowAllItems();
void ItemInStock();
void FindMusic();
void EditItem();
void RemoveItem();
void CreateOrder();
void SoldItems();
int main()
{
// Initial Load
system("cls");
system("title Music Store Management Program");
system("color 0f");
// Initial Load End
// Call Methods
db_response::ConnectionFunction();
// Call Methods End
// Variables
int chooseOneFromMenu = 0;
char exitSurity;
// Variables End
cout << "Welcome To Music Store" << endl << endl;
cout << "Music Store Menu" << endl;
cout << "1. Create Order." << endl;
cout << "2. Find Music." << endl;
cout << "3. Sold Items." << endl;
cout << "4. Item in Stock." << endl;
cout << "5. All Items." << endl;
cout << "6. Add New Item." << endl;
cout << "7. Edit Item." << endl;
cout << "8. Remove Item." << endl;
cout << "9. Exit." << endl;
cout << "Choose One: ";
cin >> chooseOneFromMenu;
switch (chooseOneFromMenu)
{
case 1:
CreateOrder();
break;
case 2:
FindMusic();
break;
case 3:
SoldItems();
break;
case 4:
ItemInStock();
break;
case 5:
ShowAllItems();
break;
case 6:
AddNewItemInDatabase();
break;
case 7:
EditItem();
break;
case 8:
RemoveItem();
break;
case 9:
ExitProgram:
cout << "Program terminating. Are you sure? (y/N): ";
cin >> exitSurity;
if (exitSurity == 'y' || exitSurity == 'Y') {
return 0;
}else if (exitSurity == 'n' || exitSurity == 'N') {
system("cls");
main();
}else {
cout << "Next time choose after read the corresponding line." << endl;
goto ExitProgram;
}
break;
default:
cout << "Please choose between 1 - 7. Press Enter To Continue...";
getch();
system("cls");
main();
break;
}
return 0;
}
// Music Store Manangement System in C++ Design and Developed by Code With C.com
void ShowAllItems()
{
system("cls");
// Variables
char choose;
// Variables End
cout << "Welcome To Music Store" << endl << endl;
cout << "Show All Items Menu" << endl << endl;
qstate = mysql_query(conn, "select * from musicinfo_tb");
if (!qstate)
{
res = mysql_store_result(conn);
while ((row = mysql_fetch_row(res)))
{
cout << "ID: " << row[0] << "\nCategory: " << row[1] << "\nType: " << row[2] << "\nName: " << row[3] << "\nArtist: " << row[4] << "\nPrice: " << row[5] << "\nQuantity: " << row[6] << endl << endl;
}
}
else
{
cout << "Query Execution Problem!" << mysql_errno(conn) << endl;
}
// Exit Code
cout << "Press 'm' to Menu and any other key to Exit: ";
cin >> choose;
if (choose == 'm' || choose == 'M')
{
main();
}
else
{
exit(0);
}
}
void AddNewItemInDatabase()
{
// Initial Load
system("cls");
// Initial Load End
// Variables
string category = "";
string type = "";
string name = "";
string artist = "";
float price = 0.0;
int quantity = 0;
char choose;
// Variables End
cout << "Welcome To Music Store" << endl << endl;
cout << "Add New Item Menu" << endl << endl;
cin.ignore(1, '\n');
cout << "Enter Category: ";
getline(cin, category);
cout << "Enter Type: ";
getline(cin, type);
cout << "Enter Name: ";
getline(cin, name);
cout << "Enter Artist: ";
getline(cin, artist);
cout << "Enter Price: ";
cin >> price;
cout << "Enter Quantity: ";
cin >> quantity;
stringstream streamPrice, streamQuan;
string sprice, squan;
streamPrice << price;
streamPrice >> sprice;
streamQuan << quantity;
streamQuan >> squan;
string insert_query = "insert into musicinfo_tb (m_category, m_type, m_name, m_artist, m_price, m_quantity) values ('"+category+"','"+type+"','"+name+"','"+artist+"','"+sprice+"','"+squan+"')";
const char* q = insert_query. c_str(); // c_str converts string to constant char and this is required
qstate = mysql_query(conn, q);
if (!qstate)
{
cout << endl << "Successfully added in database." << endl;
}
else
{
cout << "Query Execution Problem!" << mysql_errno(conn) << endl;
}
// Exit Code
cout << "Press 'm' to Menu and 'a' to Insert Again Or Any Other key to exit: ";
cin >> choose;
if (choose == 'm' || choose == 'M')
{
main();
}
else if (choose == 'a' || choose == 'A')
{
AddNewItemInDatabase();
}
else
{
exit(0);
}
}
void ItemInStock()
{
system("cls");
// Variables
char choose;
// Variables End
cout << "Welcome To Music Store" << endl << endl;
cout << "Items In Stock Menu" << endl << endl;
qstate = mysql_query(conn, "select m_name, m_artist, m_price, m_quantity from musicinfo_tb");
if (!qstate)
{
res = mysql_store_result(conn);
while ((row = mysql_fetch_row(res)))
{
if (atoi(row[3]) > 0)
{
cout << "Name: " << row[0] << "\nArtist: " << row[1] << "\nPrice: " << row[2] << "\nQuantity: " << row[3] << endl << endl;
}
}
}
else
{
cout << "Query Execution Problem!" << mysql_errno(conn) << endl;
}
cout << "Press 'm' to Menu and any other key to Exit: ";
cin >> choose;
if (choose == 'm' || choose == 'M')
{
main();
}
else
{
exit(0);
}
}
Music Store Management System: Steps On How To Run The Project
Time needed: 5 minutes
Music Store Management System Project in C++
- Step 1: Download the Source Code
First, Download the source code given below.
- Step 2: Extract File
Then, after you finished download the source code, extract the zip file.
- Step 3 : Open the C++ code editor installed on your computer.
Next, after downloading and extracting the file, open your favorite code editor in C++.
- Step 4 : Navigate to the Project Folder.
After you open your code editor in C++, you must open the file folder MusicManagement. Click the “MusicManagement” and you will be directed to your default code editor.
- Step 5 : Build and Run the Project
Lastly, click the build tab and select build & run, or you can use the shortcut key f10.
Anyway, if you want to level up your knowledge in programming especially C/C++ Programming Language, try this new article I’ve made for you Best C Projects with Source Code for Beginners Free Download.
To run this Music Store Management System Project in C++ make sure that you have Code Blocks, DEV C++, or any platform of C++ installed on your computer.
Downloadable Source Code
Conclusion
The Music Store Management System Project in C++ is one of the best systems developed in C++ and uses the MySQL database. If you want to improve and learn more about this one-of-a-kind project, download and run it in your code editor.
You can use this as a guide as well as a stepping stone to your future as a C++ developer.
Related Articles
- Music Management System Project in PHP Source Code
- Music Streaming App Project in Django with Source Code
Inquiries
If you have any questions or suggestions about the project, please feel free to leave a comment below.
I want number conversation class project in c++