-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab4(1).c
More file actions
56 lines (50 loc) · 1.18 KB
/
Lab4(1).c
File metadata and controls
56 lines (50 loc) · 1.18 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
55
56
#include<stdio.h>
struct SDate{
int Date;
char month[4];
int Year;
}StartDate;
struct employee{
char name[10];
int age;
char sex[6];
struct SDate StartDate;
float salary;
}emp[5];
Message(char s[20],int count)
{
int i;
printf("\n------- %s -------\n",s);
for(i=1;i<=count;i++)
printf("-");
printf("\n");
}
main()
{
int i;
system("color f4");
Message("Input Data ",26);
for(i=0;i<5;i++){
printf("\n\n===== Data %d =====\n",i+1);
printf("Employee name : ");
scanf("%s",emp[i].name);
printf("Age : ");
scanf("%d",&emp[i].age);
printf("Sex : ");
scanf(" %s",emp[i].sex);
printf("--Start Date--\n");
printf("Date :");
scanf("%d",&emp[i].StartDate.Date);
printf("Month :");
scanf("%s",emp[i].StartDate.month);
printf("Year : ");
scanf("%d",&emp[i].StartDate.Year);
printf("Salary : ");
scanf("%f",&emp[i].salary);
}
Message("Output Data ",26);
printf("id\tName\tAge\tSex\tStartDate\tSalary\n");
for(i=0;i<5;i++){
printf("%d\t%s\t%d\t%s\t %d %s %d\t%.2f\n",i+1,emp[i].name,emp[i].age,emp[i].sex,emp[i].StartDate.Date,emp[i].StartDate.month,emp[i].StartDate.Year,emp[i].salary);
}
}