-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStructrues.cpp
More file actions
51 lines (37 loc) · 1.07 KB
/
Copy pathStructrues.cpp
File metadata and controls
51 lines (37 loc) · 1.07 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
#include <stdio.h>
struct Workers{
char name[15];
int age;
int hourlysalary;
int hour;
int salary;
char department[50];
};
int main(){
int len,i;
printf("Please enter How Many Workers :");
scanf("%d",&len);
struct Workers worker[len];
for( i=0;i<len;i++){
printf(" %d -- Please enter Worker 's name :",i+1);
scanf("%s",&worker[i].name);
printf(" %d -- Please enter Worker 's age :",i+1);
scanf("%d",&worker[i].age);
printf(" %d -- Please enter Worker 's hourly salary:",i+1);
scanf("%d",&worker[i].hourlysalary);
printf(" %d -- Please enter Worker's hours worked:",i+1);
scanf("%d",&worker[i].hour);
printf(" %d -- Please enter Worker 's Department 's name :",i+1);
scanf("%s",&worker[i].department);
worker[i].salary=worker[i].hour*worker[i].hourlysalary;
}
printf("\nWorkers Information:\n");
for (i = 0; i < len; i++) {
printf("Name: %s\n", worker[i].name);
printf("Age: %d\n", worker[i].age);
printf("Salary: %d\n", worker[i].salary);
printf("Department: %s\n", worker[i].department);
printf("\n");
}
return 0;
}