C++ Program to Build a Computer or Mobile Repair Management System

Here, I wish to explain the topic about “C++ Program to Build a Computer or Mobile Repair Management System”. Let’s see the possibilities to perform this task below.

C++ Program to Build a Computer or Mobile Repair Management System

C++ Program to Build a Computer or Mobile Repair Management System

Program Code

/*****************************************************************************/
/*************************** PROJECT ON LAPTOP REPAIR ************************/
/*****************************************************************************/
#include<iostream>
#include<cstdlib>
#include<string.h>
#include<sstream>
#include<fstream>
using namespace std;  

void Shoping();
void Admin_Login();
void Exit();
void jump();

/****************************************************************************/
/********************** FUNCTION FOR SHOPKEEPER PORTAL **********************/
/****************************************************************************/

void Shoping()
{
	
	int ch1;
	cout<<endl;
	cout<<"tttt *****************************************************"<<endl;
	cout<<"tttt * What do you want to do ?                          *"<<endl;
    cout<<"tttt * 1) LOGIN                                          *"<<endl;
 	cout<<"tttt * 2) EXIT SOFTWARE                                  *"<<endl;
    cout<<"tttt *****************************************************"<<endl<<endl;
    cout<<"tttt *****************************************"<<endl;
	cout<<"tttt Enter your choice as (1 or 2) :"<<ends;
	cin>>ch1;
	cout<<"tttt *****************************************"<<endl<<endl;
	switch(ch1)
	{
		case 1:
			char login_usr[50],login_pwd[50];
			while(strcmp(login_usr,"Abhi")!=0)
		    {
		    	cin.ignore();
		    	cout<<"ttttt Please Enter Username :"<<ends;
		    	cin.getline(login_usr,50);
		    	if(strcmp(login_usr,"Abhi")==0)
		    	goto l2;
		    	else
		    	cout<<"tttttt Invalid Username"<<endl;
			}
			while(strcmp(login_pwd,"202")!=0)
			{
				cin.ignore();
				l2:
				cout<<"ttttt Please enter Password :"<<ends;
				cin.getline(login_pwd,50);
				if(strcmp(login_pwd,"202")==0)
				break;
				else
				cout<<"tttttt Incorrect Password"<<endl<<endl;
			}
			break;
		case 2:
			Exit();
			exit(0);
			break;				
	}
	
	
	cout<<"n";
	cout<<"ttttt~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
	cout<<"ttttt ***Login Sucessfull***"<<endl;
	cout<<"ttttt~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl;
	system("pause");
	system("cls");
	int num,quan;
	char name[100];
	A1:
	cout<<"nnn";
	cout<<"ttt***************************************************************************"<<endl;
	cout<<"ttt ITEMS: ttt Quantity: ttt PRICE: "<<endl;
	cout<<"ttt***************************************************************************"<<endl<<endl;
	cout<<"ttt 1.Laptop Skins tt 120 pcs ttt 1200/-"<<endl; 
	cout<<"ttt 2.Laptop HDMI port cables t 1000 pcs ttt 50/-"<<endl;
	cout<<"ttt 3.Display ttt 230 pcs ttt 1000/-"<<endl;
	cout<<"ttt 4.External Ram DDR tt 200 pcs ttt 3500/-"<<endl;
	cout<<"ttt 4.USB Dongal ttt 80 pcs ttt 350/-"<<endl;
	cout<<"ttt 5.JBL Speaker ttt 120 pcs ttt 1800/-"<<endl;
	cout<<"ttt 6.Cooling Pad ttt 60 pcs ttt 599/-"<<endl;
	cout<<"ttt 7.Laptop Bttery tt 150 pcs ttt 2600/-"<<endl;
	cout<<"ttt 8.Pendrives 16GB tt 400 pcs ttt 499/-"<<endl;
	cout<<"ttt 9.Laptop Sleeve tt 280 pcs ttt 1500"<<endl;
	cout<<"ttt 10.Wifi Adapter tt 26 pcs ttt 399/-"<<endl<<endl;
	
	cout<<"ttt**************************************************"<<endl;
	cout<<"ttt No. of Items Customer wants to purchase :"<<ends;
	cin>>num;
	cout<<"ttt**************************************************"<<endl<<endl;
	
		cout<<"ttttt******************************"<<endl;
		for(int i=1;i<=num;i++)
		{
		cout<<"ttttt "<<i<<".Item Name :"<<ends;
		cin.ignore();
		cin.getline(name,100);
		
		cout<<"ttttt   Item Quantity :"<<ends;
		cin>>quan;
		cout<<"n";
		}
		cout<<"ttttt******************************"<<endl<<endl;				
	
		int ss;
		cout<<"ttt************************************************************"<<endl;
		cout<<"ttt Press 1 for another entry or 2 for exit the software :"<<ends;
		cin>>ss;
		cout<<"ttt************************************************************"<<endl;
		switch(ss)
		{
			case 1:
				system("pause");
				system("cls");
				goto A1;
				break;
			case 2:
				cout<<endl;
				cout<<"ttt****************************"<<endl;
				cout<<"ttt Thanks For Shoping :)"<<endl;
				cout<<"ttt Do Visit Again ..."<<endl;
				cout<<"ttt****************************"<<endl;
				Exit();
				exit(0);
				break;	
		}
}

/****************************************************************************/
/****************************ADMIN_LOGIN FUNCTION****************************/
/****************************************************************************/
void Admin_Login()
{
	char login_un[50],login_pw[50],un[50],pw[50];
	while(strcmp(login_un,"Admin")!=0)
    {
    	cin.ignore();
    	cout<<"ttttt Please enter Username :"<<ends;
    	cin.getline(login_un,50);
    	if(strcmp(login_un,"Admin")==0)
    	goto l1;
    	else
    	cout<<"tttttt Invalid Username"<<endl;
	}
	while(strcmp(login_pw,"Pass")!=0)
	{
		cin.ignore();
		l1:
		cout<<"ttttt Please enter Password :"<<ends;
		cin.getline(login_pw,50);
		if(strcmp(login_pw,"Pass")==0)
		break;
		else
		cout<<"tttttt Incorrect Password"<<endl<<endl;
	}
	
	cout<<"n";
	cout<<"ttttt~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
	cout<<"ttttt ***Login Sucessfull***"<<endl;
	cout<<"ttttt~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
	
}


/*********************************************************************/
/**************************** EXIT FUNCTION **************************/
/*********************************************************************/

void Exit()
{
	
	cout<<endl;
	cout<<"ttttt**************************************"<<endl;
	cout<<"ttttt* Thank You for Using my Software :) *"<<endl;
	cout<<"ttttt**************************************"<<endl;
	cout<<"n";
	cout<<"ttttt*******************************************"<<endl;
	cout<<"ttttt* You have been logged out of the shop :) *"<<endl;
	cout<<"ttttt*******************************************"<<endl;
	cout<<"tttttttttttttttttttttt Designed by @Abhinav Dubey"<<endl;
	
}

void jump()
{
	int go;
	cout<<"ttt Enter 1 to go back to main menu and 2 to exit"<<ends;
	cin>>go;
	switch(go)
	{
		case 1:
			break;
		case 2:
			Exit();
			exit(0);	
			break;
	}
}

/****************************************************************************/
/***************************** FUNCTION FOR UPDATE **************************/
/****************************************************************************/

void filechange(string &line,string &newl)
{
	ifstream oldf("Customer_Details.txt",ios::in|ios::out|ios::app);
	ofstream newf("Customer_Details_Temp.txt");
	string check;
	while(oldf>>check)
	{
		if(check == line)
		{
			check = newl;
		}
		newf<<check<<endl;
	}
	
	ifstream oldff("Customer_Details_Temp.txt",ios::in|ios::out|ios::app);
	ofstream newff("Customer_Details.txt");
	
	
	while(oldff>>check)
	{
		
		newff<<check<<endl;
	}

}

/***********************************************************************************/
/**************************** CLASS FOR REPAIR TECHNICIAN **************************/
/***********************************************************************************/

class Customer
{
	long long int num;                                                    // num=mob. no. of customer
	char cname[50],submssion_date[50],product_company[50],problem[50];    // dog=date of given, product_company=product company, problem=damage part
	public:

/****************************************************/		
/************** DETAILS OF CUSTOMERS ****************/  	
/****************************************************/			
		
		void details()
		{
			
			cout<<"nnn";
			cout<<"ttt*************************************************"<<endl;
			cin.ignore();
			cout<<"ttt* Enter the name of the Customer    :"<<ends;
			cin.getline(cname,50);
			cout<<"ttt*************************************************"<<endl<<endl;
			goto l2;
			cin.ignore();
			l2:
			cout<<"ttt*************************************************"<<endl;	
			cout<<"ttt* Enter the Mob. No. of Customer    :"<<ends;
			cin>>num;
			cout<<"ttt*************************************************"<<endl<<endl;
			cout<<"ttt*************************************************"<<endl;
			cout<<"ttt* Enter the Company of Product      :"<<ends;
			cin.ignore();
			cin.getline(product_company,50);
			cout<<"ttt*************************************************"<<endl<<endl;
			goto l3;
			cin.ignore();
			l3:
			cout<<"ttt*************************************************"<<endl;	
			cout<<"ttt* Enter the Damaged part of product :"<<ends;
			
			cin.getline(problem,50);
			cout<<"ttt*************************************************"<<endl<<endl;

/****************************************************/		
/******************* STORING DATA *******************/
/****************************************************/		  			

			ofstream out;
			out.open("Customer_Details.txt",ios::app);
			if(out)
			{
				out<<cname<<","<<num<<","<<product_company<<","<<problem<<endl;
			}
		}
		
/****************************************************/		  					
/*************** SEARCH FOR CUSTOMER ****************/
/****************************************************/		  		
		
		void Search()
		{
			string search,line,c_name,mob_no,p_c,d_p;
			ifstream in;
			in.open("Customer_Details.txt");
			cout<<"nnn";
			cout<<"ttt**********************************************************************"<<endl;
			cout<<"ttt* Enter the Customer_Name or Customer_mob_number to search for :"<<ends;
			cin.ignore();
			getline(cin,search);
			cout<<"ttt***********************************************************************"<<endl;
			if(in)
			{
			while(getline(in,line))
			{
				if(line.find(search)!=string::npos)
				{
					stringstream ss(line);
					getline(ss,c_name,',');
					getline(ss,mob_no,',');
			    	getline(ss,p_c,',');
			    	getline(ss,d_p,'n');
			    	cout<<"nnn";
			    	cout<<"ttt************************************************************"<<endl;
			    	cout<<"ttt* DEATAILS OF CUSTOMER IS ::                                "<<endl;
			    	cout<<"ttt*                                                           "<<endl;
					cout<<"ttt* Name of Customer is :"<<c_name<<                        " "<<endl;
					cout<<"ttt* Mobile Number of customer is :"<<mob_no<<               " "<<endl;
					cout<<"ttt* Customer's product company is :"<<p_c<<                 " "<<endl;
					cout<<"ttt* Damage part of product is :"<<d_p<<                     " "<<endl;
					cout<<"ttt************************************************************"<<endl<<endl;
				}
			}
			}
		}
		
/****************************************************/				
/************** UPDATE FOR CUSTOMER *****************/
/****************************************************/
		  		
/*** NAME UPDATE ***/
		void NameUpdate()
		{
			string search,line,c_name,mob_no,p_c,d_p,nname;
			ifstream in;
			in.open("Customer_Details.txt");
			cout<<"nnn";
			cout<<"ttt***************************************************************"<<endl;
			cout<<"ttt* Enter the Customer name to searched his deatils:"<<ends;
			cin.ignore();
			getline(cin,search);
			cout<<"ttt***************************************************************"<<endl<<endl;
			
			if(in)
			{
			while(getline(in,line))
			{
				if(line.find(search)!=string::npos)
				{
					stringstream ss(line);
					getline(ss,c_name,',');
					getline(ss,mob_no,',');
			    	getline(ss,p_c,',');
			    	getline(ss,d_p,'n');
			    	cout<<"ttt*************************************************"<<endl;
					cout<<"ttt* Name of Customer is :"<<c_name<<"              "<<endl;
					cout<<"ttt* Mobile Number of customer is :"<<mob_no<<"     "<<endl;
					cout<<"ttt* Customer's product company is :"<<p_c<<"       "<<endl;
					cout<<"ttt* Damage part of product is :"<<d_p<<endl<<"     "<<endl;
				 	cout<<"ttt*************************************************"<<endl<<endl;
				 	cout<<"ttt**********************************************"<<endl;
		     		cout<<"ttt* Enter the New Name of the Customer :- "<<ends;
					getline(cin,nname);
					cout<<"ttt**********************************************"<<endl<<endl;
					string newl;
					newl=nname +","+ mob_no +","+ p_c +","+ d_p + "n";
					filechange(line,newl);
				}
			}
	    	}
	    }
	    
/*** NUMBER UPDATE ***/
		
		void NumUpdate()
		{
			string search,line,c_name,mob_no,p_c,d_p,new_no;
			ifstream in;
			in.open("Customer_Details.txt");
			cout<<"ttt************************************************************************"<<endl;
			cout<<"ttt* Enter the Customer name or Customer no. to show details of Customer :*"<<ends;
			cin.ignore();
			getline(cin,search);
			cout<<"ttt************************************************************************"<<endl;
			
			if(in)
			{
			while(getline(in,line))
			{
				if(line.find(search)!=string::npos)
				{
					stringstream ss(line);
					getline(ss,c_name,',');
					getline(ss,mob_no,',');
			    	getline(ss,p_c,',');
			    	getline(ss,d_p,'n');
			    	cout<<"ttt*********************************************"<<endl;
					cout<<"ttt* Name of Customer is :"<<c_name<<"          "<<endl;
					cout<<"ttt* Mobile Number of customer is :"<<mob_no<<" "<<endl;
					cout<<"ttt* Customer's product company is :"<<p_c<<"   "<<endl;
					cout<<"ttt* Damage part of product is :"<<d_p<<"       "<<endl;
					cout<<"ttt*********************************************"<<endl<<endl;
				 	cout<<"ttt********************************************************"<<endl;
		     		cout<<"ttt* Enter the new mobile number of the customer :- "<<ends;
					cin>>new_no;
					cout<<"ttt********************************************************"<<endl;
					string newl;
					newl=c_name + "," + new_no + "," + p_c + "," + d_p + "n";
					filechange(line,newl);
				}
			}
	    	}
	    }
	    
/****************************************************/
/***************** DELETE CUSTOMER ******************/		
/****************************************************/					    
	    		
		void Delete()
		{
			string search,line,c_name,mob_no,p_c,d_p,nname;
			ifstream in;
			in.open("Customer_Details.txt");
			cout<<"nnn";
			cout<<"ttt************************************************"<<endl;
			cout<<"ttt*  Enter the name of customer to delete :"<<ends;
			cin.ignore();
			getline(cin,search);
			cout<<"ttt************************************************"<<endl<<endl;
			if(in)
			{
			while(getline(in,line))
			{
				if(line.find(search)!=string::npos)
				{
					stringstream ss(line);
					getline(ss,c_name,',');
					getline(ss,mob_no,',');
			    	getline(ss,p_c,',');
			    	getline(ss,d_p,'n');
			    	
					string newl;
					newl= "n";
					filechange(line,newl);
					cout<<"ttt***************************************"<<endl;
					cout<<"ttt*  Customer Details has been deleted  *"<<endl;
					cout<<"ttt***************************************"<<endl;
				}
				
			}
	    	}
	    }
	    
/****************************************************/		
/************** TO SHOW ALL CUSTOMERS ***************/		
/****************************************************/			    
		
		void showall()
	    {
	    		cout<<"nnn";
	    		string line,c_name,mob_no,p_c,d_p;
				ifstream in;
				in.open("Customer_Details.txt");
				if(in)
				{
					
				

				while(in>>line)
				{
					stringstream ss(line);
					getline(ss,c_name,',');
					getline(ss,mob_no,',');
			    	getline(ss,p_c,',');
			    	getline(ss,d_p,'n');
			    
			    
			    	
					cout<<"ttt* Name of Customer is :"<<c_name<<                        " "<<endl;
					cout<<"ttt* Mobile Number of customer is :"<<mob_no<<               " "<<endl;
					cout<<"ttt* Customer's product company is :"<<p_c<<                 " "<<endl;
					cout<<"ttt* Damage part of product is :"<<d_p<<                     " "<<endl;
					cout<<"ttt************************************************************"<<endl;
				}
				}
				in.close();
		}
			
};

/****************************************************************************/
/**************************** MAIN FUNCTION *********************************/
/****************************************************************************/
main()
{
/****************************************************/	
/**************** MAIN PAGE DESIGN ******************/
/****************************************************/    
	cout<<"tttttt*****************************************************************************************************************"<<endl<<endl;
	cout<<"tttttttttt  #          #      ###### #######  ###   ######"<<endl;
	cout<<"tttttttttt  #         # #     #    #    #    #   #  #    #"<<endl;
	cout<<"tttttttttt  #        #   #    ######    #    #   #  ######"<<endl;
	cout<<"tttttttttt  #       #######   #         #    #   #  #    "<<endl;
	cout<<"tttttttttt  ###### #       #  #         #     ###   #    "<<endl<<endl<<endl;
	cout<<"ttttttt  ######   #####   ######     #       #   ######           ######  #   #   ###   ######"<<endl;
	cout<<"ttttttt  #    #   #       #    #    # #      #   #    #           #       #   #  #   #  #    #"<<endl;
	cout<<"ttttttt  ######   ####    ######   #   #     #   ######           ######  #####  #   #  ######"<<endl;
	cout<<"ttttttt  # #      #       #       #######    #   # #                   #  #   #  #   #  #     "<<endl;
	cout<<"ttttttt  #  ##    #####   #      #       #   #   #  ##            ######  #   #   ###   #     "<<endl<<endl;
	cout<<"ttttttt tttttttttt                By Abhinav Dubey"<<endl<<endl;
    cout<<"tttttt*****************************************************************************************************************"<<endl<<endl<<endl;
	cout<<"ttttt================================================================================================================================="<<"n";
    cout<<endl<<endl;
    cout<<"tttttttttt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "<<endl;
    cout<<"ttttttttttt   *** WELCOME TO OUR SHOP *** "<<endl;
    cout<<"tttttttttt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "<<endl;

/****************************************************/
/****************** JOB SELECTION *******************/ 
/****************************************************/           
 	int ch2;
 	cout<<"ttt**********************************"<<endl;
	cout<<"ttt* SELECT YOUR RESPECTIVE JOB :)  *"<<endl;
	cout<<"ttt* 1. Shopkeeper :                *"<<endl;
	cout<<"ttt* 2. Repair Technician :         *"<<endl;
	cout<<"ttt**********************************"<<endl<<endl;
	cout<<"ttt Enter your choice :"<<ends;
	cin>>ch2;
	switch(ch2)
	{
		case 1:
			Shoping();
			Exit();
			exit(0);
			break;
		case 2:
			break;	
	}
    
/****************************************************/    
/************** Login/Exit Selection ****************/
/****************************************************/

	int ch3;
	cout<<endl;
	cout<<"tttt *****************************************************"<<endl;
	cout<<"tttt * What do you want to do ?                          *"<<endl;
    cout<<"tttt * 1) LOGIN                                          *"<<endl;
 	cout<<"tttt * 2) EXIT SOFTWARE                                  *"<<endl;
    cout<<"tttt *****************************************************"<<endl<<endl;
    cout<<"tttt *****************************************"<<endl;
	cout<<"tttt Enter your choice as (1 or 2) :"<<ends;
	cin>>ch3;
	cout<<"tttt *****************************************"<<endl<<endl;
	
	switch(ch3)
	{
		case 1:
			Admin_Login();
			system("pause");
			system("cls");
			break;
		case 2:
			Exit();
			exit(0);
			break;
		default:
			return(1);
				
	}
/****************************************************/
/********** OPTIONS FOR TASKS TO PERFORM ************/	
/****************************************************/	
	A:
	cout<<endl<<endl;
	cout<<"ttt Select the options to perform the respective tasks :)"<<endl<<endl;
	cout<<"ttt******************************************"<<endl;
	cout<<"ttt* 01 - To Add new customers :-           *"<<endl;
	cout<<"ttt* 02 - To Search any customer :-         *"<<endl;
	cout<<"ttt* 03 - To Update a customer :-           *"<<endl;
	cout<<"ttt* 04 - To Delete a new customer :-       *"<<endl;
	cout<<"ttt* 05 - To Show all Customers of shop :-  *"<<endl;
	cout<<"ttt******************************************"<<endl<<endl;
	int select;
	cout<<"ttt*********************************************************************"<<endl;
	cout<<"ttt Enter your option number to perform the respective task"<<ends;
	cin>>select;
	cout<<"ttt*********************************************************************"<<endl;
	
	switch(select)
	{
		case 01:
			system("cls");
			Customer c;
    		c.details();
    		jump();
    		goto A;
        	break;
        case 02:
        	system("cls");
        	c.Search();
        	jump();
        	goto A;
        	break;
        case 03:
        	system("cls");
       		int choice;
       		cout<<"nnn";
       		cout<<"ttt*********************************"<<endl;
       		cout<<"ttt* What do you want to update :  *"<<endl;
       		cout<<"ttt*                               *"<<endl;
			cout<<"ttt* 1) To update name             *"<<endl;
       		cout<<"ttt* 2) To update number           *"<<endl;
       		cout<<"ttt*********************************"<<endl<<endl;
			cout<<"ttt*************************"<<endl;
			cout<<"ttt Enter your choice :"<<ends;
       		cin>>choice;
       		cout<<"ttt*************************"<<endl<<endl;
       		switch(choice)
       		{
       			case 1:
       				
       				c.NameUpdate();
       				jump();
       				goto A;
       				break;
      			case 2:
					c.NumUpdate();
					jump();
					goto A;	
					break;
			}	
			break;
		case 04:
			system("cls");
			c.Delete();
			jump();
			goto A;
			break;
		case 05:
			system("cls");
			c.showall();
			jump();
			goto A;
			break;	
				
    }
}

Final Words

We hope this article “C++ Program to Build a Computer or Mobile Repair Management System” will be useful to you. If you face any issues please let me know via the comment section. Share this article with other C/C++ developers via social networks.

Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment