Complaint Management System using C++

Complaint Management System using C++ (With Source Code)

Complaint Management System using C++ (With Source Code)

Hello, coders. Welcome to the codewithrandom blog. In this article, we will learn how to create a Complaint Management System using C++ (With Source Code). We will be creating a Complaint Management System for a Travel Agency.

A complaint management system is a software or an application which is meant to assist organizations in dealing with customer or client concerns. In general, it is a platform where people may file complaints about a product, service, or any other issue, and the system organizes and monitors the complaint resolution process automatically. The system is often made up of a number of modules that allow users to create, manage, and monitor complaints. A dashboard that offers an overview of all complaints, their status, and any connected information may also be included in the system.

Simple College Management System using C++ (With Source Code)

Objective of the system:

A complaint management system’s primary goal is to streamline the complaint resolution process, enhance customer happiness, and minimize the stress on support workers. The system assists organizations in responding to complaints in a fast and effective manner, tracking complaint progress, and ensuring that all complaints are properly handled.

It has two user types:

  1. Customer
  2. Administrator.

The customer can store a new complaint by providing details like complaint number, customer name, date, and description of the complaint.

The administrator can log in the system with a username and password and execute actions such as filing a new complaint, viewing complaints, updating complaint status, printing complaints, and cancelling complaints.

Overview of the UI:

  1. Customer
  2. Administrator
  3. Exit

Input number associated with your input type:

The user will enter the option number to proceed further.

  • Option 1 will allow you to raise a complaint as a Customer.
  • Option 2 will let you log in as an Administrator and give you further options to choose from:
  1. Create a Complaint
  2. View Complaint
  3. Update Complaint Status
  4. Print the complaint
  5. Cancel a Complaint
  6. Logout

The user will enter a choice and then proceed further.

  • Option 3 Exit

Complaint Management System Source code:

You can directly use this code by copying it in your IDE to understand the working and then can create the project.

// Administrator Password to Login
//-------------------------------------------------------
/*
username == user
password == pass
*/

//Standard Library

#include <iostream>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <fstream>

using namespace std;

class complaint	//base class
{
public:
    void customer_StoreComplaint();
    void admin_menu();
    	void create_complaint();
    	void cancel_complaint();
    	void update_complaint ();
    void print_complaint();
    void view_complaint();
    void exit();
    
    complaint();//constuctor

};

 complaint::complaint ()
{

}		//constructor for class CarType


struct node //construct node
{
    int complaint_number;
    string customerName;
    string date;
    string x;

    node *prev;
    node *next;
    node *link;

}*q, *temp;				//pointer declaration


node *start_ptr = NULL;
node *head = NULL;
node *last = NULL;

int main()	// Main function
{
    complaint admin;
    system("COLOR 79");		//Color to change background
    int option;
    do
    {
    cout<<"\n";
    	cout<<"\t\t ================================================\n";
    cout<<"\t\t|   Complaint Management System - TRAVEL AGENCY |\n";
    cout<<"\t\t ================================================\n\n\n";

    cout<<"\t\t-------------------------------------------------\n";
    cout<<"\t\t|\t1. Customer \t\t\t\t|\n";
    cout<<"\t\t-------------------------------------------------\n";
    cout<<"\t\t-------------------------------------------------\n";
    cout<<"\t\t|\t2. Administrator \t\t\t|\n";
    cout<<"\t\t-------------------------------------------------\n";
    cout<<"\t\t-------------------------------------------------\n";
    cout<<"\t\t|\t3. EXIT \t\t\t\t|\n";
    cout<<"\t\t-------------------------------------------------\n\n";

    	cout<<"\t\tInput number Associated with Your User Type: ";
    cin>>option;
    switch(option)
    {
        case 1:
            admin.customer_StoreComplaint();
            break;
        case 2:
            admin.admin_menu();
            break;
        case 3:
            admin.exit();	//function exit
            goto a;
            break;
    }
    
    }while(option!=3);//end do
        a://goto
        cout<<"thank you"<<endl;
        system ("PAUSE");

}//end  main function

void complaint::customer_StoreComplaint()		
{
    system("cls");
    cout<<"\n";
    	cout<<"\t\t ================================================\n";
    cout<<"\t\t|   Complaint Management System - TRAVEL AGENCY |\n";
    cout<<"\t\t ================================================\n\n\n";
    cout <<"\nAdd Your Complaint Details\n";
    cout <<"________________________________\n\n";

    node *temp;
    temp = new node;
    cout << "Type Complaint no: ";
    	cin >> temp->complaint_number;
    cout<< "Enter Your Name: ";
    cin.ignore();
    getline(cin, temp->customerName);
    cout<<"Enter Date : ";
    cin>>temp->date;
    cout << "Complaint Description:";
    cout<<"( 1000 words maximum ) \n";
    cin.ignore();
    getline(cin, temp->x);

    cout<<"==========================================================================="<<endl;
    	cout << "Complaint added Successfully"<<endl;
    	cout<<"==========================================================================="<<endl;
    
    system ("PAUSE");

    	temp->next=NULL;
    if(start_ptr!=NULL)
    {
        temp->next=start_ptr;
    }
    start_ptr=temp;
    system("cls");
}

void complaint::admin_menu()
{
    complaint admin;
    int menu;
    string userName, userPassword;

    system("cls");
    cout<<"\n";
    	cout<<"\t\t ===================================================\n";
    cout<<"\t\t|   Complaint Management System - TRAVEL AGENCY    |\n";
    cout<<"\t\t ===================================================\n\n\n";
    	cout<<"\t\t----------------------------------------------------\n";
    	cout<<"\t\t\t  Administrator / Staff Login      \n";
    	cout<<"\t\t----------------------------------------------------\n\n";
    	cout << "\n\n\t\tPlease enter your user name: ";
    	cin >> userName;
    	cout << "\n\n\t\tPlease enter your user password: ";
    	cin >> userPassword;

    	if (userName == "user" && userPassword == "pass")
    	{
    	do
    {
        	system("cls");
        	cout<<"\n";
        	cout<<"\t\t ===================================================\n";
        cout<<"\t\t|   Complaint Management System - TRAVEL AGENCY    |\n";
        cout<<"\t\t ===================================================\n\n\n";
        cout<<"\t\t--------------------------------------------------\n";
        cout<<"\t\t||\t1. Create a Complaint \t\t\t ||\n";
        cout<<"\t\t||\t2. View Complaint\t\t\t ||\n";
        cout<<"\t\t||\t3. Update Complaint Status \t\t ||\n";
        cout<<"\t\t||\t4. Print the complaint \t\t\t ||\n";
        cout<<"\t\t||\t5. Cancel a Complaint \t\t\t ||\n";
        cout<<"\t\t||\t6. Logout\t\t\t\t ||\n";
        cout<<"\t\t--------------------------------------------------\n";
        cout<<"Enter choice: ";
//---Brought To You By code-projects.org---
        cin>>menu;

        switch (menu)
        {
            case 1:
            {
                admin.create_complaint();
                break;
            }


            case 2:
            {
                admin.view_complaint();
                system("PAUSE");
                break;
            }

            case 3:
            {
                admin.update_complaint();
                system("PAUSE");
                break;
            }

            case 4:
            {
                admin.print_complaint();
                system("PAUSE");
                break;
            }
            case 5:
            {
                admin.cancel_complaint();
                system("PAUSE");
                break;
            }
        		case 6:
            {
                cout<<"You are Logged Out...!\n\n\n\n";
                system ("PAUSE");
                admin.admin_menu();
                break;
            }

        }//end Switch
        
        }while(menu!=6);//end do
        cout<<"thank you"<<endl;
        system ("PAUSE");
    }

    else
    {
           cout << "\n\n\t\tInvalid login attempt. Please try again.\n" << '\n';
           system("PAUSE");
           system ("cls");
           admin.admin_menu();


    }
}

void complaint::create_complaint()
{
    system("cls");
    cout<<"\n";
    	cout<<"\t\t ================================================\n";
    cout<<"\t\t|   Complaint Management System - TRAVEL AGENCY |\n";
    cout<<"\t\t ================================================\n\n\n";
    cout <<"\nAdd Complaint Details of Customer\n";
    cout <<"_____________________________________ \n\n";

    node *temp;
    temp = new node;
    cout << "Type Complaint no: ";
    	cin >> temp->complaint_number;
    cout<< "Enter Customer Name: ";
    cin.ignore();
    getline(cin, temp->customerName);
    cout<<"Enter Date : ";
    cin>>temp->date;
    cout << "Complaint Description:";
    cout<<"( 1000 words maximum ) \n";
    cin.ignore();
    getline(cin, temp->x);

    cout<<"==========================================================================="<<endl;
    	cout << "Complaint added Successfully"<<endl;
    	cout<<"==========================================================================="<<endl;
    	cout << "Go to Print Complaint to print the Complaint"<<endl;
    	cout<<"==========================================================================="<<endl;
    system ("PAUSE");

    	temp->next=NULL;
    if(start_ptr!=NULL)
    {
        temp->next=start_ptr;
    }
    start_ptr=temp;
    system("cls");
}


void complaint::view_complaint()
{
    int num;
    bool found;			//variable to search
    system("cls");
    node *temp;

    temp=start_ptr;
    found = false;
    cout<<"\n";
    	cout<<"\t\t ================================================\n";
    cout<<"\t\t|   Complaint Management System - TRAVEL AGENCY |\n";
    cout<<"\t\t ================================================\n\n\n";
    cout<<" Enter the Complaint Number To Look into The Complaint Details\n";
    cin>>num;
    cout<<"\n";
    cout<<"---------------------------------------------------------------------------"<<endl;
    cout <<"\t\tHere is the Complaint list\n";
    cout<<"---------------------------------------------------------------------------"<<endl;


    if(temp == NULL) 
    {
        cout << "\tThere is no Complaint to show\n\t\t\tSo The List is Empty\n\n\n";
    }
    while(temp !=NULL && !found)
    {
        if (temp->complaint_number==num)
        {
            found = true;
        }
        else
        {
            temp = temp -> next;
        }
        if (found)
        {
        cout <<"Complaint Number : "<<temp->complaint_number;
        cout <<"\n";
        cout<<"Customer Name: "<<temp->customerName<<endl;

        cout<<"Complain Date : "<<temp->date<<endl;

        cout<<"_____________________________________________________________________________"<<endl;
        cout<<"-------------------------"<<endl;
        cout<<"|Complaint description: |"<<endl;
        cout<<"-------------------------"<<endl;
        cout<<temp->x;

        cout <<"\n";
        cout<<"_____________________________________________________________________________"<<endl;

        }


}
}


void complaint::cancel_complaint()
{
    system("cls");
    int num, count;
    cout<<"\n";
    	cout<<"\t\t ================================================\n";
    cout<<"\t\t|   Complaint Management System - TRAVEL AGENCY |\n";
    cout<<"\t\t ================================================\n\n\n";
    	cout<<"Enter the Complaint number you want to delete \n";
    	cin>>num;
    	node *q;
    node *temp;
    bool found;

    if(start_ptr == NULL)
        cerr<<"Can not cancel from an empty list.\n";
    else
    {
        if(start_ptr->complaint_number == num)
        {
            q = start_ptr;
            start_ptr = start_ptr->next;
            count--;
            if(start_ptr == NULL)
            last = NULL;
            delete q;
            cout<<"The Complaint is Cancelled Successfully"<<endl;
        }
        else
        {
            found = false;
            temp = start_ptr;
            q = start_ptr->next;

        while((!found) && (q != NULL))
        {
  			if(q->complaint_number != num)
            {
                temp = q;
                q = q-> next;
            }
            else
                found = true;
        }

            if(found)
            {
                temp->next = q->next;
                count--;

                if(last == q)
                last = temp;
                delete q;
                cout<<"The Complaint is Cancelled Successfully"<<endl;
            }
            else
                cout<<"Complaint to be Cancelled is not in the list."<<endl;
            }
        }
}	//End function

void complaint::update_complaint()
{
 system("cls");
 int sid;
 bool found;
 found = false;
 temp = start_ptr;
 cout<<"\n";
 cout<<"\t\t ================================================\n";
 cout<<"\t\t|   Complaint Management System - TRAVEL AGENCY |\n";
 cout<<"\t\t ================================================\n\n\n";
 cout<<"Enter Complaint Number To Update: ";
 cin>>sid;
 if (temp==NULL && sid==0)
 {
    cout<<"No Complaint To Update..!"<<endl;
 }

 else
 {
 	while(temp !=NULL && !found)
    {
        if (temp->complaint_number==sid)
        {
            found = true;
        }
        else
        {
            temp = temp -> next;
        }
    if (found)
    {
    cout << "Change  Complaint Number: ";
    	cin >> temp->complaint_number;
    cout<< "Change Customer Name: ";
    cin.ignore();
    getline(cin, temp->customerName);
    cout<<"Change Date : ";
    cin>>temp->date;
    cout << "Complaint Description:"<< endl;
    cout<<"( 1000 words maximum ) \n";
    cout << "  " ;
    cin.ignore();
    getline(cin, temp->x);
    
    system("PAUSE");
    temp = temp->next;


    }

 cout<<"COMPLAINT RECORD UPDATED....!\n\n"<<endl;
 }

 	if(temp != NULL && temp->complaint_number != sid)
 	{
 	cout<<"Invalid Complaint Number...!\n\n"<<endl;
    }

}

}		//End function

void complaint::print_complaint()		
{
    int num;	
    bool found;			//variable to search 
    system("cls");
    ofstream outputFile;
    outputFile.open("prototype.txt");
    node *temp;

    temp=start_ptr;
    found = false;
 	cout<<"\n";
 	cout<<"\t\t ================================================\n";
 	cout<<"\t\t|   Complaint Management System - TRAVEL AGENCY |\n";
 	cout<<"\t\t ================================================\n\n\n";
 	outputFile<<"\n";
 	outputFile<<"\t\t ================================================\n";
 	outputFile<<"\t\t|   Complaint Management System - TRAVEL AGENCY |\n";
 	outputFile<<"\t\t ================================================\n\n\n";
    cout<<" Enter the Complaint Number To Print The Complaint Details\n";
    cin>>num;
    cout<<"\n";
    cout<<"---------------------------------------------------------------------------"<<endl;
    cout <<"\t\tHere is the Complaint list\n"; 
    cout<<"---------------------------------------------------------------------------"<<endl;


    if(temp == NULL)
    {
        cout << "\tThere is no Complaint to show\n\t\t\tSo The List is Empty\n\n\n";
    }
    while(temp !=NULL && !found)
    {
        if (temp->complaint_number==num)
        {
            found = true;
        }
        else
        {
            temp = temp -> next;
        }
        if (found)	//print the complaint
        {
        cout <<"Complaint Number : "<<temp->complaint_number;
                outputFile << "Complaint Number : "<<temp->complaint_number << endl;
                cout <<"\n";
                cout<<"Customer Name: "<<temp->customerName<<endl;
                outputFile << "Customer Name: "<<temp->customerName<<endl;
                cout<<"Order Date : "<<temp->date<<endl;
                outputFile << "Order Date : "<<temp->date<<endl;
                cout<<"____________________________________________________________________________"<<endl;
                outputFile << "____________________________________________________________________________"<<endl;
                cout<<"Complaint description: "<<endl;
                outputFile << "Complaint description: "<<endl;
                cout<<"----------------------"<<endl;
                outputFile<<"------------------------------------------------------------------------------"<<endl;
                cout<< temp->x;
                outputFile << temp->x<<endl; 
                cout <<"\n";
                cout<<"____________________________________________________________________________"<<endl;
                outputFile << "____________________________________________________________________________"<<endl;
                
            temp=temp->next;
        
        }
        outputFile.close();
        cout << "Complaint Printed Succesfully....!\n";

}
}	//End function

void complaint::exit() //Function to exit
{
    cout<<"\nYou choose to exit.\n"<<endl;
}	//end function exit


////////////////////////////THE END OF PROGRAM//////////////////////////////////////////

Now let us understand the code:-

  • After writing the header of the code with the required libraries – iostream, stdlib.h, string, cctype, fstream.
  • We will use object-oriented programming and class concepts to define a base class called complaint. We wiull declare the member functions – customer_StoreComplaint(), admin_menu(), create_complaint(), cancel_complaint(), update_complaint (), print_complaint(), view_complaint(), and exit() and a constructor – complaint().
  • Now we will create a struct node to manage complaints. It will have attributes like complaint number, customer name, date, and complaint description.
  • Now the main() function will provide logic for the function calls. We will first display the user options to choose from – Customer, Administrator and Exit. We will write a switch case to select among the options and call the corresponding function.
  • We will declare the functions outside the class using scope resolution operator.
  • The customer_StoreComplaint() function will allow the customer to store their complaint details such as complaint number, name, date, and description.
  • The admin_menu() function will allow the administrator to log in using a predefined username = user and password = pass, and access the complaint management menu, which allows them to create, view, update, print, and cancel complaints. We will use a linked list to store the complaint details. We will write a switch case to select between the  further options.
  • The create_complaint() function will let the administrator raise a complaint on behalf of the customer by entering complaint no., customer name, date and description.
  • The view_complaint() function will let the administrator view the complaint details by entering the complaint number.
  • The cancel_complaint() function will let the administrator cancel a complaint by entering the complaint number.
  • The update_complaint() function will let the administrator update specific complaint by entering the complaint number.
  • The print_complaint() function will let the administrator to print the complaint by entering the complaint number using the ofstream output file.
  • The exit() function will let you exit from the program.

final Output:-

Here is an example to show how this project works 

Complaint Management System using C++

Adding complaint as a customer:

Complaint Management System using C++

log in as administrator:

Complaint Management System using C++

Complaint Management System using C++

Complaint Management System using C++

Conclusion

We have reached the end of this article and have a lot more projects in C++ coming so stay tuned. We have started with awesome and fun projects for you all to understand C++. Learning C++ by creating fun projects makes learning easy and interesting.

Bakery Management System using C++ (With Source Code)

If you enjoyed the article and learned something new today, let us know in the comments.

Thank you.

Happy Reading! 🙂

ADVERTISEMENT

Follow: CodeWithRandom

ADVERTISEMENT



Leave a Reply