Mini project Employee record system using C

The employee record system is very simple and for very beginner mini project. It is based one the menu-driven program for elementary database management. It employs all the basic technique of file handling in C. It consists of following features
  • Writing the data in binary file
  • Reading the data from binary file
  • Modify the record
  • Delete the record

This project is a learning milestone for a beginner who wants to step into the database management project in C. The code is also available on GitHub.

Here are List of Mini projects in C

Source Code


SHARE Mini project Employee record system using C

You may also like...

21 Responses

  1. zameer says:

    we need to download "windows.h" for code support

    please provide us the same.

  2. I think you tried it on Turbo C which doesn't support windows.h. Best way is to use Code::Blocks IDE having GCC compiler

  3. manan7008 says:

    Hey can any one help me to make project on "Review Management System"..please i dont have any idea how to make it give me any code or idea how to do it…

  4. Humayun says:

    sir i want school managment system project in c language
    my id is [email protected]
    kindly send me this project as soon as possible


  6. // Do not change, delete or rename any thing in the following code
    // Complete this program by creating the missing functions
    // and providing and menu driven interface
    #include pl give me the correct ans whats wrong in this programe

    using namespace std;

    struct EmpSal{
    int empId;
    char name[50];
    int basic;
    double commRate;

    int searchEmpId(EmpSal emp[], int id);
    void printEmp(EmpSal emp[], int index);
    void init(EmpSal emp[]);
    //int namefounder(EmpSal []);
    int namefounder(EmpSal emp[], char name[]);

    void main() {
    EmpSal emp[5]; // Struct Array emp is our DB (do not make this array global … leave it here as it is)
    init(emp); // initialize struct array

    int option = 0;
    do {
    // Here first design and print a menu
    // Then call an appopriate function in each case depending upon the slection made by the user
    int choice;
    cout<<"Please Enter your choice.n1.Search by id.n2.Search by name.n3.Average of basic salary of all employees.n4.Detail of employee having maximum commision rate.n5.Earning of an employee.n6.Print Details.n7.exit"<>choice;
    switch (choice){
    case 1:{

    // 1- Search Emp by empId
    int id; cout << "Enter the ID you to search : "; cin >> id;
    int index = searchEmpId(emp, id);
    if(index == -1)
    cout << id << " deoes not exist in array." << endl;
    printEmp(emp, index);
    case 2:
    char p[50];
    cout<<"Enter the name you want to search : ";


    // 2- Search Emp by name (there may be more than one emp having same name)

    // 3- Calculate and Print average of basic salary of all employees

    // 4- Fiand and Print the detail of an employee having maximum commision rate

    // 5- Calculate and print earnings of an employee given its employee id and sales as input ( salary = basic + Commision Rate * (Sales)

    // 6- Print detail of all employees

    // 7- Exit

    } while(option != 7);

    }// end main

    void init(EmpSal emp[]) {
    EmpSal e1 = {101, "Asad Arshad", 5000, 0.10};
    emp[0] = e1;
    EmpSal e2 = {102, "Muddaser Mukhtar", 6000, 0.50};
    emp[1] = e2;
    EmpSal e3 = {103, "Aqib Javed", 7000, 0.10};
    emp[2] = e3;
    EmpSal e4 = {104, "Saqib Sarfraz", 8000, 0.15};
    emp[3] = e4;
    EmpSal e5 = {110, "Asad Arshad", 7000, 0.20};
    emp[4] = e5;
    int namefounder(EmpSal emp[], char name[])// search by name
    int counter=0;
    int flag=0;
    int saver;
    for(int x=0;x<5;x++)

    if(counter==1){return saver;}else
    {int id;
    cout<<"The name "<>id;
    int b=searchEmpId(emp,id);
    if(b== -1)
    {cout<<"The id "< " << endl;
    cout << "Emp ID = " << emp[index].empId << endl;
    cout << "Name = " << emp[index].name << endl;
    cout << "Basic Sal = " << emp[index].basic << endl;
    cout << "Comm Rate = " << emp[index].commRate << endl;
    cout<< "***********************************************" << endl;

    int searchEmpId(EmpSal emp[], int id) {

    int found = 0;
    for(int i=0; i < 5; i++) {
    if( id == emp[i].empId ) {
    return i;
    found = 1;
    if(found == 0)
    return -1;

  7. Please help me on above progarm i am getting few errors

    #include ///for input output functions like printf, scanf
    #include ///for windows related functions (not important)
    #include ///string operations

    /** List of Global Variable */
    COORD coord = {0,0}; /// top-left corner of window

    function : gotoxy
    @param input: x and y coordinates
    @param output: moves the cursor in specified position of console
    void gotoxy(int x,int y){
    coord.X = x; coord.Y = y;

    /** Main function started */

    int main(){
    FILE *fp, *ft; /// file pointers
    char another, choice;

    /** structure that represent a employee */
    struct emp{
    char name[40]; ///name of employee
    int age; /// age of employee
    float bs; /// basic salary of employee

    struct emp e; /// structure variable creation

    char empname[40]; /// string to store name of the employee

    long int recsize; /// size of each record of employee

    /** open the file in binary read and write mode
    * if the file EMP.DAT already exists then it open that file in read write mode
    * if the file doesn't exit it simply create a new copy
    fp = fopen("EMP.DAT","rb+");
    if(fp == NULL){
    fp = fopen("EMP.DAT","wb+");
    if(fp == NULL){
    printf("Connot open file");

    /// sizeo of each record i.e. size of structure variable e
    recsize = sizeof(e);

    /// infinite loop continues untile the break statement encounter
    system("cls"); ///clear the console window
    gotoxy(30,10); /// move the cursor to postion 30, 10 from top-left corner
    printf("1. Add Record"); /// option for add record
    printf("2. List Records"); /// option for showing existing record
    printf("3. Modify Records"); /// option for editing record
    printf("4. Delete Records"); /// option for deleting record
    printf("5. Exit"); /// exit from the program
    printf("Your Choice: "); /// enter the choice 1, 2, 3, 4, 5
    fflush(stdin); /// flush the input buffer
    choice = getche(); /// get the input from keyboard
    case '1': /// if user press 1
    fseek(fp,0,SEEK_END); /// search the file and move cursor to end of the file
    /// here 0 indicates moving 0 distance from the end of the file

    another = 'y';
    while(another == 'y'){ /// if user want to add another record
    printf("nEnter name: ");
    printf("nEnter age: ");
    scanf("%d", &e.age);
    printf("nEnter basic salary: ");
    scanf("%f", &;

    fwrite(&e,recsize,1,fp); /// write the record in the file

    printf("nAdd another record(y/n) ");
    another = getche();
    case '2':
    rewind(fp); ///this moves file cursor to start of the file
    while(fread(&e,recsize,1,fp)==1){ /// read the file and fetch the record one record per fetch
    printf("n%s %d %.2f",,e.age,; /// print the name, age and basic salary

  8. Anonymous says:

    i have some very simple programming doubt in two dimensional character arrays

    here is the program

    # include
    # include
    void main()
    int i=0;
    char name[3][10];
    printf("n enter the names n");

    printf("you entered these namesn");


    in this program i would like to chk for null character using for do i do that

    why because suppose..if the size of array is 3X5

    and if I enter any name which is more that 5 characters..I get an error null point termination..

    should I use 2 loops to enter the names and chk for null character

    or with single loop how should I chk

  9. sir I want your help on driving licence management system .I have done the coding part but I am not able to store data my . my teacher has suggested to do file handling in it but I am not able to so

    struct dl
    char name[40];
    char add[100];
    int licno;
    char bg;
    int uid; //unique id number will entered by user like uidai
    struct dl b[100];
    int count=0;
    void addnewdl(struct dl b1[])
    printf("Enter dl no");
    printf("Enter Name");
    printf("Enter dl holder Address");
    printf("Enter blood group");
    printf("enter udi number");
    void DisplayAll()
    int i;
    printf("ndl No=%d",b[i].licno);
    printf("ndl Holder Name=%s",b[i].name);
    printf("nblood group=%s",b[i].bg);
    printf("ndl Holder Address=%s",b[i].add);
    void lost()
    {int v;
    printf("enter udi numbern");
    printf("complaint reg");
    //printf("ndl No=%d",b[count].licno);
    //printf("ndl Holder Name=%s",b[count].name);
    void theft()
    {int x;
    printf("enter udi numbern");
    printf("complaint reg");
    //printf("ndl No=%d",b[x].licno);
    //printf("ndl Holder Name=%s",b[x].name);
    void main()
    int choice,n;
    printf("n 1. to apply for new dl");
    printf("n 2. to display all dl");
    printf("n 3. register for loss of dl");
    printf("n 4.register for theft of dl");
    printf("n 5. to exit");
    printf("nEnter Your Choice ");
    case 1:
    case 2:
    case 3:
    case 4:
    case 5:

  10. Hey can any one help me to make a c++ project on "employee leave Management System"..please i dont have any idea how to make it plz send me the program as soon as possible on [email protected]

  11. Unknown says:

    sir you have written in the above code upto case 2!!! what about remaining cases ??? are they ok as you have mention in the top code..?????

  12. Sirrr I want the source file in downloadable form…. Plzzz sir send to my mail [email protected]

  13. Nurisha sir ap flow chart paya kya is ka.

  14. pls modify the program in case 3 , it is not running properly while modifying the data.

  15. hey can you help me out with the flow chart and the block diagram of the "employee record system" using programming c…

  16. Cant we write this program without using files concept

  17. Unknown says:

    Cant we write this program without using files concept

  18. Anonymous says:

    to correctly modify u need to change the strcmp function in case 3 to be equal to 1

  19. Unknown says:

    Sir Send employee management system program in c

  20. Unknown says:

    write a program in c to issue registers.

Leave a Reply

Your email address will not be published. Required fields are marked *