Using Structures write an interactive program in C language to create an application program for a small office to maintain the employee’s database. This application should be having menu options like (20 Marks)
• Creating a New Record
• Reading/Listing of Records
• Modify the record
• Delete the record
Each employee record should have Employee Name, Employee ID, Department Name, Salary, Position, Date of Joining, etc. The application should be designed user-friendly.
Here's a detailed explanation and implementation for the requested C program that uses structures to manage an employee database with functionalities for creating, reading, modifying, and deleting records.
---
### Code Explanation
The program uses a structure `Employee` to store the details of each employee. Key elements include:
- Fields in the structure: Employee Name, Employee ID, Department, Salary, Position, and Date of Joining.
- Dynamic Management: An array is used to hold multiple employees. A counter (`empCount`) keeps track of the number of employees.
- Functions for operations: Each menu option is implemented as a separate function for modularity.
### Implementation
```c
#include <stdio.h>
#include <string.h>
#define MAX_EMPLOYEES 100
// Structure definition for Employee
struct Employee {
int id;
char name[50];
char department[30];
float salary;
char position[30];
char dateOfJoining[15];
};
// Global variables
struct Employee employees[MAX_EMPLOYEES];
int empCount = 0;
// Function prototypes
void createNewRecord();
void listRecords();
void modifyRecord();
void deleteRecord();
void displayMenu();
int main() {
int choice;
while (1) {
displayMenu();
printf("\nEnter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
createNewRecord();
break;
case 2:
listRecords();
break;
case 3:
modifyRecord();
break;
case 4:
deleteRecord();
break;
________ _____ ________ ________ _______ ____ ______ ____ ___.
_____ _________ ___ ______ ______ ______ ________ _________.
______ ______ ___ ________ __________ ____ _________ ______.
____ ________ _____ _____ _________ ___ _________ _________ ________ __________ _________ ____.
______ _______ _______ ______ __________ __________.
____ ____ ______ ________ _____ ____ ___ __________ ______ _______ ___ ________.
__________ _______ _____ _________ ____ ______ ______ ___.
____ _______ __________ _____ __________ ________ ____ _______ ______.
_________ __________ ___ ____ ___.
_______ _________ ____ ___ ______ ____ _______ ___ _________ ___ ______.
_______ ___ _____ ________ __________ ___ ___ _______ ____ __________ ______ _________.
______ _______ ________ _________ ______ ___ ________ ____ ______.
_____ _____ ________ ______ __________ _____ _______ _____.
________ _______ __________ ________ _____ _________ _______ ___ __________.
_______ ___ __________ ________ _______ _________.
_______ _________ ___ ____ ________ ___ ____ _________ ______.
________ _________ _______ ________ ____ __________ ________ __________ ____ _____.
___ ______ ________ ____ ____ ___ ________ ______ ______ _________.
___ ______ _____ ___ ___ ___.
______ ____ ___ __________ ____ ________ _______ ____ ________ _______ __________.
________ ___ _________ ___ ______ ________ ____ _________ _________ _________.
________ ________ _________ ____ _____ __________ ______ _______.
________ ____ ___ ___ ___ ____ ___ __________ ___ _________.
________ ___ ___ ___ ___ _______ __________ _____ _______ _____.
___ __________ ________ _________ ___ _____.
_________ ________ ___ _____ _____.
__________ __________ _______ ___ ______ ________ _____ _________ _____ _____.
____ ______ _____ _________ ____ _____.
_________ _________ ________ _______ _______ _____ __________ __________ ____ _______.
________ ______ ______ __________ _____ __________ ___ ____.
________ ________ _________ ________ ________ ______ ______.
___ ______ ______ ______ ____.
_________ ___ _______ _____ _________ _________ _____ _______ _____.
_____ _____ ______ _____ ______ __________ ______ ______.
_____ ____ ______ _______ ______ ____ _____ ________ ___ ________ __________.
____ _________ ____ ___ ______.
_____ ____ ___ _________ ______ __________ _________ ________ ________ ______.
___ _________ ___ _____ ________.
___ __________ _________ _______ _____ ________ __________ _____ _________ ___.
_____ ______ _________ __________ _________ _____ _____ _____ __________ ______ ___.
_____ _________ ________ __________ ___ ______ _________ _______ _______ _____.
______ _______ ___ ______ ____ _____.
_______ _____ ________ _________ ____ ___.
_________ ___ _________ __________ __________ ________ ______ ___ _______.
_________ _________ ______ ____ _____ ________ ________.
___ ___ ________ _________ ____ _______ _________ ___ ___ ____ _____.
__________ ________ ________ __________ _______ _______ ____ ________.
_______ __________ _______ ________ ___ _________ _________ __________ ___ __________ ____ _____.
_____ _____ ___ _______ ____ _______.
__________ ______ __________ _______ ______ _________ _________.
____ ____ ____ _____ ___ __________ _________ __________ _________ _______ _______ ____.
___ ________ ______ ___ __________.
_________ _____ ____ _________ ________ _______ _______ __________.
____ __________ _________ ____ ________ ______ ________ _________ ____.
_______ ________ _________ _______ ___ ________ _____ ____ ______ ____ __________ ______.
_________ ____ _____ _______ __________ ________ ____ ________ __________.
________ __________ _________ _________ _______ ________.
____ _____ ___ ________ ______ ___ ______ ____ ___ __________.
________ _______ _______ _____ ________ ________ __________ ____ ___.
____ _______ _____ _______ __________ ___ ____ __________ ______.
________ __________ ______ _____ _______ ________ ____ _____ ________ _______ ______.
_________ ______ _________ ___ _______.
____ ________ ___ ____ ____ _________ ______ ________.
_____ _____ ____ _______ ____ ____ ___ _______ ________ _____ ______ ___.
_________ _____ _______ _____ __________ ________ __________ ________ ________.
_________ _____ _________ ___ ____ ______ _____ ______ ______.
____ ________ ____ _______ ___ __________ _______ ________ ____ _________ _______.
____ ________ ____ ___ ____ __________ __________ _______ __________.
___ ______ ___ __________ ____ _____ _____ ______ ___ ____ ___.
______ _____ _____ _________ __________ ______.
_________ _____ ____ _________ ______ ____ ________.
________ ________ _____ ___ ____ ____.
_____ __________ __________ _____ _______ ____ __________ ______.
__________ ____ ___ _____ ______.
___ __________ ____ _________ ______.
___ ______ __________ ____ ____ ________ _________ ______ ___ ___ _________.
___ _____ __________ ______ ____ ________ _______ ___ _________ ____ ____.
______ __________ ______ ______ __________ __________ __________ _______ ________ ____.
_______ ____ _________ __________ ________.
___ _______ __________ ______ ________ _________ ___ _____ ___ _____.
____ __________ _______ ___ ______ ______ _____ _______ ______ __________ _____ __________.
____ _________ _______ ___ ________ ____ ____ _________ ________ ___ ________ _________.
______ ______ _________ _______ _________ __________ ____ _________ ____ ________ _________ ___.
__________ _____ ______ _______ __________ ________ _____ ________ ________ _________ _____.
_______ ______ _________ ________ ______ ______ ______.
_________ ___ _____ ______ ___ ___ _____ __________ ________ ______ _______ ________.
______ _______ ________ ________ ___ __________ __________ _____.
______ __________ ______ ___ _________ _______ ______ _____ __________ ___ ______ _____.
___ ____ _________ ______ __________ _____ _________ _____ __________.
______ ______ _______ ___ __________ _____ ________ ______ ____ ________.
_______ _______ ___ ____ ____ ____ ___.
________ ____ ______ ___ _________ __________ ________.
_________ ______ _____ ________ ____.
____ ___ ________ ______ __________ ________ ___ ______ __________ ___.
______ ___ _____ ___ ___ _________ _____ _________.
_______ ___ ___ _____ __________ ______ _____ ________.
___ _____ __________ __________ _______ _______.
____ _______ ____ _____ ________ ___ ____ _________ ____ ______ _____.
_______ _____ ____ ________ ______.
______ ___ ______ ___ ______ ______ _____.
_________ _________ ______ _________ _____ _______ ______ ________ _________.
________ ____ _____ __________ _____ __________ _________ ____.
________ __________ ______ _________ _______ ________ ___ ______ _______ _________ _________ ____.
_________ ____ _______ __________ ________ _____ _____ ____ ___ __________ ____.
________ __________ _________ ___ ____.
______ ____ _____ _____ ____.
__________ ________ _________ ___ _____ ________ ______ _____ ___ ________.
___ ______ _____ ________ _____ ____ _______ _________ ______ ____ _______.
_______ ________ ____ _____ __________.
___ ________ _________ __________ ________ ______ ______.
__________ _________ ___ ________ _____ __________ _________.
____ _________ ______ ___ ______.
_____ ______ _____ ___ _______ ____ __________ __________ ____ _________ ________ ________.
________ __________ _______ ____ ____.
____ ________ ______ _________ _______ _____.
__________ ____ ___ ______ _____ __________ _________ _______.
_________ __________ ________ ______ ________.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
✓ Unlock up to 60% of the answer
✓ No payment required