Employee Management System with CPP

Last updated Sep 14, 2021

Employee's Management System allows you to manage your employee's data in C++ without Database in System's Memory. This kind of project is suitable for small scaled startup companies or NGOs.
The program employee management system store employee ID, name, post, department and salary of employee. Initially, it has no data. Thus, we have to add employee records choosing appropriate option in this program

Features :

  • Tables for New Employees and List The Employee Table
  • Insert New Entry
  • Delete An Entry
  • Edit An Entry
  • Search A Record
  • Sort The Table
 

Project includes a detailed entry scheme for Employee's Registration, which includes: Age, Name, Code, Experience (in years), Designation, etc

 

Pre-requisites:

  • PC with 2GB ram(min)
  • CodeBlocks Installed with GNU compiler
  • 200Kb od storage
 

Installing CodeBlocks

  • Go to CodeBlocks Official Website to Download the Software

  • Install this software in your C(main/windows) drive

  • Watch this Video to Install GNU Compiler in CodeBlocks

  • Open this .c file and click on Build and Run

 

Employee Management System with CPP

 

 

Employee Management System with CPP

 

Output

You will see below output:

Porgram Starts

Employee Management System with CPP

Build Tables

CPP Employee Management System Project

List of Tables

CPP Projects - Employee Management System with CPP

Delete Entries

CPP Projects - Employee Management System with CPP

Search Entries

Employee Management System with CPP

Quit Program

Employee Management System with CPP

 

 

Download Source code

 

#include<iostream>

#include<cstring>

#include<cstdlib>

#include<iomanip>

#include<windows.h>

        #include<dos.h>

        #include<conio.h>

        #include<cstdio>

#define max 20

        using namespace std;

        struct employee

        {

        char name[20];

        long int code;

        char designation[20];

        int exp;

        int age;

        };

        int num;

        employee emp[max],tempemp[max],sortemp[max],sortemp1[max];

        int main()

        {

        system("cls");

        void build();

        void list();

        void insert();

        void deletes();

        void edit();

        void search();

        void sort();

        char option;

        void menu();

        menu();

        while((option=cin.get())!='q')

        {

        switch(option)

        {

        case 'b':

        build();

        break;

        case 'l':

        list();

        break;

        case 'i':

        insert();

        break;

        case 'd':

        deletes();

        break;

        case 'e':

        edit();

        break;

        case 's':

        search();

        break;

        case 'n':

        sort();

        break;

        }

        menu();

        }

        return 0;

        }

        void menu()

        {

        system("cls");


        cout<<"          ";

        printf("\n*****  Employees Management System 1.0 ***** ");





        cout<"             ";

        cout<<"\n\t\t Press  b---->Built The Employee Table ";

        cout<<"             ";

        cout<<"\n\t\t Press  l---->List The Employee Table  ";

        cout<<"             ";

        cout<<"\n\t\t Press  i---->Insert New Entry        ";

        cout<<"             ";

        cout<<"\n\t\t Press  d---->Delete An Entry         ";

        cout<<"             ";

        cout<<"\n\t\t Press  e---->Edit An Entry           ";

        cout<<"             ";

        cout<<"\n\t\t Press  s---->Search A Record         ";

        cout<<"             ";

        cout<<"\n\t\t Press  n---->Sort The Table          ";

        cout<<"             ";

        cout<<"\n\t\t Press  q---------->Quit Program              ";

        cout<<"             ";

        cout<<"\n\n \t\t Select Your Option Please ====> ";

        }


        void build()

        {


        system("cls");


        printf("Build The Table");

        cout<"maximum number of entries  -----  >  20"<"how many do you want    ----->";

        cin>>num;

        cout<<"Enter The Following Items"<for(int i=0;i<=num-1;i++)

        {

        cout<<" Name  ";

        cin>>emp[i].name;

        cout<<"Code  ";

        cin>>emp[i].code;

        cout<<"Designation  ";

        cin>>emp[i].designation;

        cout<<"Years of Experience  ";

        cin>>emp[i].exp;

        cout<<"Age  ";

        cin>>emp[i].age;

        }

        cout<<"going to main menu";

        Sleep(500);

        }


        void  list()

        {

        system("cls");


        printf("       ********List The Table********");

        cout<"     Name     Code     Designation     Years(EXP)     Age "<"    ------------------------------------------------------"<for(int i=0;i<=num-1;i++)

        {

        cout<13)<6)<15)<10)<15)<"going to main menu";

        getch();

        }

        void insert()

        {

        system("cls");

        int i=num;

        num+=1;

        printf("Insert New Record");

        cout<"Enter The Following Items"<"Name  ";

        cin>>emp[i].name;

        cout<<"Code  ";

        cin>>emp[i].code;

        cout<<"Designation  ";

        cin>>emp[i].designation;

        cout<<"Years of Experience  ";

        cin>>emp[i].exp;

        cout<<"Age  ";

        cin>>emp[i].age;

        cout<"going to main menu";

        Sleep(500);


        }



        void deletes()

        {

        system("cls");


        int code;

        int check;

        printf("Delete An Entry");

        cout<"Enter An JobCode To Delete That Entry  ";

        cin>>code;

        int i;

        for(i=0;i<=num-1;i++)

        {

        if(emp[i].code==code)

        {

        check=i;

        }

        }

        for(i=0;i<=num-1;i++)

        {

        if(i==check)

        {

        continue;

        }

        else

        {

        if(i>check)

        {

        tempemp[i-1]=emp[i];

        }

        else

        {

        tempemp[i]=emp[i];

        }

        }

        }

        num--;


        for(i=0;i<=num-1;i++)

        {

        emp[i]=tempemp[i];

        }

        }


        void edit()

        {

        system("cls");

        int jobcode;


        printf("          Edit An Entry           ");

        cout<int i;

        void editmenu();

        void editname(int);

        void editcode(int);

        void editdes(int);

        void editexp(int);

        void editage(int);

        char option;


        cout<<"Enter An jobcode To Edit An Entry----  ";

        cin>>jobcode;

        editmenu();

        for(i=0;i<=num-1;i++)

        {

        if(emp[i].code==jobcode)

        {


        while((option=cin.get())!='q')

        {

        switch(option)

        {

        case 'n':

        editname(i);

        break;

        case 'c':

        editcode(i);

        break;

        case 'd':

        editdes(i);

        break;

        case 'e':

        editexp(i);

        break;

        case 'a':

        editage(i);

        break;

        }

        editmenu();

        }

        }

        }

        }

        void editmenu()

        {

        system("cls");

        cout<<"        What Do You Want To edit";

        cout<<"          n--------->Name ";

        cout<<"          c--------->Code ";

        cout<<"          d--------->Designation";

        cout<<"          e--------->Experience ";

        cout<<"          a--------->Age        ";

        cout<<"              q----->QUIT                            ";

        cout<<"   Options Please ---->>>  ";

        }

        void editname(int i)

        {

        cout<<"Enter New Name----->  ";

        cin>>emp[i].name;

        }

        void editcode(int i)

        {

        cout<<"Enter New Job Code----->  ";

        cin>>emp[i].code;

        }

        void editdes(int i)

        {

        cout<<"enter new designation----->  ";

        cin>>emp[i].designation;

        }

        void editexp(int i)

        {

        cout<<"Enter new Years of Experience";

        cin>>emp[i].exp;

        }

        void editage(int i)

        {

        cout<<"Enter new Age ";

        cin>>emp[i].age;

        }


        void search()

        {

        system("cls");

        printf("Welcome To Search Of Employee Database ");

        cout<int jobcode;

        cout<<"You Can Search Only By Jobcode Of An Employee";

        cout<<"Enter Code Of An Employee                    ";

        cin>>jobcode;

        for(int i=0;i<=num-1;i++)

        {

        if(emp[i].code==jobcode)

        {


        cout<<"     Name     Code     Designation     Years(EXP)     Age ";

        cout<<"     ------------------------------------------------------                                  ";

        cout<13)<6)<15)<10)<15)<"going to main menu";

        getch();



        }


        void sort()

        {

        system("cls");

        printf("Sort The Databse By JobCode");

        void sortmenu();

        void sortname();

        void sortcode();

        void sortdes();

        void sortexp();

        char option;

        void sortage();


        cout<while((option=cin.get())!='q')

        {

        switch(option)

        {

        case 'n':

        sortname();

        break;

        case 'c':

        sortcode();

        break;

        case 'd':

        sortdes();

        break;

        case 'e':

        sortexp();

        break;

        case 'a':

        sortage();

        break;

        }

        sortmenu();

        }

        }



        void sortmenu()

        {

        system("cls");

        cout<<"          What Do You Want To edit";

        cout<<"          n--------->Name         ";

        cout<<"          c--------->Code         ";

        cout<<"          d--------->Designation  ";

        cout<<"          e--------->Experience   ";

        cout<<"          a--------->Age          ";

        cout<<"                               q----->QUIT            ";

        cout<<"   Options Please ---->>>  ";  }




        void sortname()

        {

        system("cls");

        int i,j;

        struct employee temp[max];

        for(i=0;i<=num-1;i++)

        {

        sortemp1[i]=emp[i];

        }

        for(i=0;i<=num-1;i++)

        {

        for(j=0;j<=num-1;j++)

        {

        if(strcmp(sortemp1[i].name,sortemp1[j].name)<=0)

        {

        temp[i]=sortemp1[i];

        sortemp1[i]=sortemp1[j];

        sortemp1[j]=temp[i];

        }

        }

        }


        for( i=0;i<=num-1;i++)

        {


        cout<<"     Name     Code     Designation     Years(EXP)     Age ";

        cout<<"     ------------------------------------------------------                                  ";

        for( i=0;i<=num-1;i++)

        {

        cout<13)<6)<15)<10)<15)<"Press Any Key To Go Back";

        getch();


        } }


        void sortcode()

        {

        system("cls");

        int i,j;

        struct employee temp[max];

        for(i=0;i<=num-1;i++)

        {

        sortemp1[i]=emp[i];

        }

        for(i=0;i<=num-1;i++)

        {

        for(j=0;j<=num-1;j++)

        {

        if(sortemp1[i].code<sortemp1[j].code)

        {

        temp[i]=sortemp1[i];

        sortemp1[i]=sortemp1[j];

        sortemp1[j]=temp[i];

        }

        }

        }


        for( i=0;i<=num-1;i++)

        {


        cout<<"     Name     Code     Designation     Years(EXP)     Age ";

        cout<<"     ------------------------------------------------------                                  ";

        for( i=0;i<=num-1;i++)

        {

        cout<13)<6)<15)<10)<15)<"Press Any Key To Go Back";

        getch();


        } }



        void sortdes()

        {

        system("cls");

        int i,j;

        struct employee temp[max];

        for(i=0;i<=num-1;i++)

        {

        sortemp1[i]=emp[i];

        }

        for(i=0;i<=num-1;i++)

        {

        for(j=0;j<=num-1;j++)

        {

        if(strcmp(sortemp1[i].designation,sortemp1[j].designation)<=0)

        {

        temp[i]=sortemp1[i];

        sortemp1[i]=sortemp1[j];

        sortemp1[j]=temp[i];

        }

        }

        }


        for( i=0;i<=num-1;i++)

        {


        cout<<"     Name     Code     Designation     Years(EXP)     Age";

        cout<<"     ------------------------------------------------------                                 ";

        for( i=0;i<=num-1;i++)

        {

        cout<13)<6)<15)<10)<15)<"Press Any Key To Go Back";

        getch();


        } }


        void sortage()

        {

        system("cls");

        int i,j;

        struct employee temp[max];

        for(i=0;i<=num-1;i++)

        {

        sortemp1[i]=emp[i];

        }

        for(i=0;i<=num-1;i++)

        {

        for(j=0;j<=num-1;j++)

        {

        if(sortemp1[i].age<sortemp1[j].age)

        {

        temp[i]=sortemp1[i];

        sortemp1[i]=sortemp1[j];

        sortemp1[j]=temp[i];

        }

        }

        }


        for( i=0;i<=num-1;i++)

        {


        cout<<"     Name     Code     Designation     Years(EXP)     Age";

        cout<<"     ------------------------------------------------------                                 ";

        for( i=0;i<=num-1;i++)

        {

        cout<13)<6)<15)<10)<15)<"Press Any Key To Go Back";

        getch();


        } }



        void sortexp()

        {

        system("cls");

        int i,j;

        struct employee temp[max];

        for(i=0;i<=num-1;i++)

        {

        sortemp1[i]=emp[i];

        }

        for(i=0;i<=num-1;i++)

        {

        for(j=0;j<=num-1;j++)

        {

        if(sortemp1[i].exp<sortemp1[j].exp)

        {

        temp[i]=sortemp1[i];

        sortemp1[i]=sortemp1[j];

        sortemp1[j]=temp[i];

        }

        }

        }


        for( i=0;i<=num-1;i++)

        {


        cout<<"     Name     Code     Designation     Years(EXP)     Age ";

        cout<<"  ------------------------------------------------------ ";

        for( i=0;i<=num-1;i++)

        {

        cout<13)<6)<15)<10)<15)<"Press Any Key To Go Back";

        getch();


        } }

Conclusion: In this post we covered how to install codeblocks IDE and open Employee Management System project and run the application.

 

Beginner Projects

Library Management System Project with CPP

Python Library Management System

Java Library Management System Source code

 

Calendar application with C Language

Contact Management System with C

Bank Management System with C

Article Contributed By :
https://www.rrtutors.com/site_assets/profile/assets/img/avataaars.svg

1612 Views