-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path35th_program.c
More file actions
54 lines (54 loc) · 1.48 KB
/
Copy path35th_program.c
File metadata and controls
54 lines (54 loc) · 1.48 KB
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
// Write a program to read and print employee's details using structure.
#include<stdio.h>
typedef struct employee
{
char employeeID[9];
char employeeName[100];
int age;
float salary;
char department[100];
char jobTitle[100];
char contactNo[11];
}emply;
void dataEntry(emply *a);
void checkData(emply a);
int main()
{
int no_of_employee;
printf("Enter the no of employee : ");
scanf("%d",&no_of_employee);
emply empData[no_of_employee];
printf("Enter employee details \n");
for(int i=0;i<no_of_employee;i++)
{
dataEntry(&empData[i]);
}
printf("We have these records \n");
for(int i=0;i<no_of_employee;i++)
{
checkData(empData[i]);
}
return 0;
}
void dataEntry(emply *a)
{
printf("Enter 8 digits employeeID : ");
scanf("%s",a->employeeID);
printf("Enter name : ");
scanf(" %[^\n]s",a->employeeName);
printf("Enter age : ");
scanf("%d",&a->age);
printf("Enter salary : ");
scanf("%f",&a->salary);
printf("Enter department : ");
scanf(" %[^\n]s",a->department);
printf("Enter jobtitle : ");
scanf(" %[^\n]s",a->jobTitle);
printf("Enter contact no : ");
scanf(" %[^\n]s",a->contactNo);
printf("\n\n");
}
void checkData(emply a)
{
printf("EmployeeID :%s | Name :%s | Age :%d | Salary :%.1f | Department :%s | JobTitle :%s | Contact No :%s \n",a.employeeID,a.employeeName,a.age,a.salary,a.department,a.jobTitle,a.contactNo);
}