A company maintains the following details about its employees : Name, Telephone number, Designation, Department, Date of joining and Salary. Write a program which allows the user to add, modify, delete, view and search an employee's details. Maintain all employee data in a file.

#include <stdio.h>
#include "employee.h"

int main(void)
{
char ch;
int id;

do
{
printf("\n\'A\'dd\n\'M\'odify\n\'V\'iew\n\'S\'earch\n\'D\'elete\n\'E\'xit\nChoice :");
fflush(stdin);
scanf("%c", &ch);
switch(ch)
{
case 'a': case 'A': add(); break;
case 'v': case 'V': view(); break;
case 's': case 'S':
printf("\nEnter employee id :");
scanf("%d", &id);
if(!search(id)) printf("\nRecord not found\n");
break;
case 'd': case 'D':
printf("\nEnter employee id :");
scanf("%d", &id);
del(id);
break;
case 'm': case 'M':
printf("\nEnter employee id :");
scanf("%d", &id);
modify(id);
break;
case 'e': case 'E': break;
default:
printf("\nInvalid choice\n");
}
}while(ch != 'e' && ch != 'E');

return 0;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin