-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.c
75 lines (68 loc) · 1.88 KB
/
delete.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* ---------------------------- Function Description ---------------------------------- */
/***
* Name of the module: delete.c
-----------------------------------------
* Name of the Function: delete_data function
*
* Date of creation: 16/11/2022
*
* Author of module: Nikhil K
*
* Description of module:
* In main menu,when delete_data selected the user will ask for employee id, delete employee details
But user can’t delete employee details in excel sheet.
* Different functions supported in the module: No
* Global variables accessed or modified by the module: Access Structure pointer, TS_India_Employee_DB
* Revision/Modification History:25/11/2022
***/
#include"header.h"
void delete_data(employee_database **emp)
{
char num[15];
char check=0;
printf("Enter the Delete Employee Id\n");
scanf("%s",num);
employee_database *temp= *emp, *last = *emp;
while(temp!=0)
{
if(*emp == NULL)
{
printf("Database is Empty !!!\n");
return;
}
else if((strcmp((*emp)->emp_id,num))==0)
{
printf("|***************Warning****************|\n");
printf("If you delete employee detials once's you can not recovery it....\nPress Yes|No \n");
scanf(" %c",&check);
if((check == 'y')||(check == 'Y'))
{
database_delete(temp);
*emp = temp->link;
free(temp);
return ;
}
else
return ;
}
else if((strcmp(temp->emp_id,num))==0)
{
printf("|***************Warning****************|\n");
printf("If you delete employee detials once's you can not recovery it....\nPress Yes|No \n");
scanf(" %c",&check);
if((check == 'y')||(check == 'Y'))
{
printf("deleted\n");
database_delete(temp);
last->link = temp->link;
free(temp);
sleep(3);
return ;
}
else
return;
}
last = temp;
temp = temp->link;
}
}