0% found this document useful (0 votes)
38 views7 pages

Project 7 (080,164,165)

This document contains the code for a C++ program that manages employee and attendance records. It defines structures to store employee and attendance data, and includes functions to insert, update, delete, and display records. The main function demonstrates inserting some sample data and displaying it. The program allows managing employee information like name, designation and phone number. Attendance records can be added against employees for specific dates and displayed by employee, month or absentees for a given employee and month.

Uploaded by

mi480207
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views7 pages

Project 7 (080,164,165)

This document contains the code for a C++ program that manages employee and attendance records. It defines structures to store employee and attendance data, and includes functions to insert, update, delete, and display records. The main function demonstrates inserting some sample data and displaying it. The program allows managing employee information like name, designation and phone number. Attendance records can be added against employees for specific dates and displayed by employee, month or absentees for a given employee and month.

Uploaded by

mi480207
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

INSTITUTE NAME : UNIVERSITY OF CENTRAL PUNJAB

DEPARTMENT NAME : BS COMPUTER SCIENCE


SECTION NAME : BS-CS-A

TITLE : PROJECT-7 ( EMPLOYEE & ATTENDANCE )


PRESENTED TO : PROF. HARIS
PRESENTED BY : MUHAMMAD IBRAHIM (080)
SHEHREYAR MAJEED (164)
ABDULLAH KHALID (165

#include <iostream.h>

#include<conio.h>
#include <string.h>

const int MAX_EMPLOYEES = 1000;

const int MAX_ATTENDANCE = 10000;

struct Employee {

int eid;

char ename[50];

char designation[50];

char phone[15];

};

struct Attendance {

int eid;

int day;

int month;

int status;

};

Employee employees[MAX_EMPLOYEE];

Attendance att[MAX_ATTENDACE];

int employeeCount = 0;

int attendanceCount = 0;

void insertEmployeeRecord(int eid, char ename, char designation, char phone);

void updateEmployeeRecord(int eid, char ename, char designation, char phone);void


deleteEmployeeRecord(int eid);

void displayAllEmployeeRecords();
void displayEmployeeRecord(int eid);

void insertAttendanceRecord(int eid, int day, int month, int status);

void updateAttendanceStatus(int eid, int day, int month, int status);

void deleteAttendanceRecord(int eid, int day, int month);

void displayAllAttendanceRecords();

void displayAttendanceRecordsForMonth(int month);

void displayAbsenteesForMonth(int eid, int month);

int main() {

insertEmployeeRecord();

insertEmployeeRecord();

insertEmployeeRecord();

insertAttendanceRecord();

insertAttendanceRecord();

insertAttendanceRecord();

displayAllEmployeeRecords();

displayAllAttendanceRecords();

void insertEmployeeRecord(int eid, char ename, char designation, char phone) {

cin>>employees[employeeCount].eid;

if (employeeCount < MAX_EMPLOYEES) {

strcpy(employees[employeeCount].ename, ename);

strcpy(employees[employeeCount].designation, designation);

strcpy(employees[employeeCount].phone, phone);

employeeCount++;
}

void updateEmployeeRecord(int eid, char ename, char designation, char phone) {

for (int i = 0; i < employeeCount; ++i) {

cin>>employees[i].eid;

if (employees[i].eid == eid) {

strcpy(employees[i].ename, ename);

strcpy(employees[i].designation, designation);

strcpy(employees[i].phone, phone);

break;

void deleteEmployeeRecord(int eid) {

for (int i = 0; i < employeeCount; ++i) {

cin>>employees[i].eid;

if (employees[i].eid == eid) {

for (int j = i; j < employeeCount - 1; ++j) {

employees[j] = employees[j + 1];

employeeCount--;

break;

void displayAllEmployeeRecords() {
cout << "\nEmployee Records: ";

for (int i = 0; i < employeeCount; ++i) {

cout << "Employee ID: " << employees[i].eid << ", Name: " << employees[i].ename << ", Designation:
" << employees[i].designation << ", Phone: " << employees[i].phone;

void displayEmployeeRecord(int eid) {

for (int i = 0; i < employeeCount; ++i) {

cin>>employees[i].eid;

if (employees[i].eid == eid) {

cout << "Employee ID: " << employees[i].eid << ", Name: " << employees[i].ename << ",
Designation: " << employees[i].designation << ", Phone: " << employees[i].phone;

return;

cout << "Employee not found!\n";

void insertAttendanceRecord(int eid, int day, int month, int status) {

if (attendanceCount < MAX_ATTENDANCE) {

attendance[attendanceCount].eid = eid;

attendance[attendanceCount].day = day;

attendance[attendanceCount].month = month;

attendance[attendanceCount].status = status;

attendanceCount++;

}
void updateAttendanceStatus(int eid, int day, int month, int status) {

for (int i = 0; i < attendanceCount; ++i) {

cin>>employees[i].eid;

cin>>employees[i].day;

cin>>employees[i].month;

if (attendance[i].eid == eid && attendance[i].day == day && attendance[i].month == month) {

attendance[i].status = status;

break;

void deleteAttendanceRecord(int eid, int day, int month) {

for (int i = 0; i < attendanceCount; ++i) {

cin>>employees[i].eid;

cin>>employees[i].day;

cin>>employees[i].month;

if (attendance[i].eid == eid && attendance[i].day == day && attendance[i].month == month) {

for (int j = i; j < attendanceCount - 1; ++j) {

attendance[j] = attendance[j + 1];

attendanceCount--;

break;

void displayAllAttendanceRecords() {

cout << "\nAttendance Records: ";


for (int i = 0; i < attendanceCount; ++i) {

cout << "Employee ID: " << attendance[i].eid << ", Day: " << attendance[i].day << ", Month: " <<
attendance[i].month << ", Status: " << attendance[i].status;

void displayAttendanceRecordsForMonth(int month) {

cout << "\nAttendance Records for Month: " << month;

for (int i = 0; i < attendanceCount; ++i) {

cin>>employees[i].month;

if (attendance[i].month == month) {

cout << "Employee ID: " << attendance[i].eid << ", Day: " << attendance[i].day << ", Status: " <<
attendance[i].status;

void displayAbsenteesForMonth(int eid, int month) {

int totalAbsentees = 0;

for (int i = 0; i < attendanceCount; ++i) {

cin>>employees[i].eid;

cin>>employees[i].month;

if (attendance[i].eid == eid && attendance[i].month == month) {

totalAbsentees++;

cout << "Employee ID: " << eid << ", Total Absentees for Month " << month << ": " << totalAbsentees;

You might also like