0% found this document useful (0 votes)
18 views1 page

Activity 2.cpp

The document is a C++ program that implements an attendance system for two employees over ten days. It provides a menu for marking attendance, generating an attendance report, and exiting the program. The attendance data is stored in a 2D array and allows users to input attendance as present (1) or absent (0) for each employee and day.

Uploaded by

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

Activity 2.cpp

The document is a C++ program that implements an attendance system for two employees over ten days. It provides a menu for marking attendance, generating an attendance report, and exiting the program. The attendance data is stored in a 2D array and allows users to input attendance as present (1) or absent (0) for each employee and day.

Uploaded by

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

#include <iostream>

using namespace std;

int main() {
int emp = 2;
int days = 10;
int empAttend[emp][days];

while (true) {
cout << "\nAttendance System Menu:\n";
cout << "1. Mark Attendance\n";
cout << "2. Generate Attendance Report\n";
cout << "3. Exit\n";
cout << "Enter your choice: ";

int choice;
cin >> choice;

switch (choice) {
case 1:
for (int i = 0; i < emp; i++) {
cout << "Enter attendance for Employee " << i + 1 << " (1 for
present, 0 for absent) for each day:\n";
for (int j = 0; j < days; j++) {
cout << "Day " << j + 1 << ": ";
cin >> empAttend[i][j];
}
}
cout << "Attendance marked successfully.\n";
break;
case 2:
cout << "Attendance Report:\n";
cout << "Employee";
for (int j = 0; j < days; j++) {
cout << "Day " << j + 1;
}
cout << "Total\n";

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


int AttendTotal = 0;
cout << "Employee " << i + 1<<": ";
for (int j = 0; j < days; j++) {
cout << empAttend[i][j];
AttendTotal += empAttend[i][j];
}
cout << ": "<<AttendTotal << "\n";
}
break;
case 3:
cout << "Exiting the program.\n";
return 0;
default:
cout << "Invalid choice. Please try again.\n";
}
}

return 0;
}

You might also like