Friday, May 30, 2014

WRITE A PROGRAMME TO STORE THE DETAILS OF AN EMPLOYEE WHERE DETAILS CONSIST OF EMPLOYEE'S SNO,NAME,DOB AND DOJ

#include<stdio.h>
#include<conio.h>
typedef struct date
{
int day;
int mon;
int year;
}date;
typedef struct emp
{
int sno;
char name[20];
date dob,doj;
}emp;
void main()
{
int i,n;
emp e1[10];
clrscr();
printf("enter the no employees\n");
scanf("%d",&n);
printf("enter the details of employee\n");
for(i=0;i<n;i++)
{
printf("enter the sno and name of employee\n");
scanf("%d%s%",&e1[i].sno,e1[i].name);
printf("enter the dob of employee\n");
scanf("%d%d%d",&e1[i].dob.day,&e1[i].dob.mon,&e1[i].dob.year);
printf("enter the doj of employee\n");
scanf("%d%d%d",&e1[i].doj.day,&e1[i].doj.mon,&e1[i].doj.year);
}
printf("the details of employee are \n");
for(i=0;i<n;i++)
{
printf("\n");
printf("sno->%d\nname->%s\n",e1[i].sno,e1[i].name);
printf("dob->%d%d%d\n",e1[i].dob.day,e1[i].dob.mon,e1[i].dob.year);
printf("doj->%d%d%d\n",e1[i].doj.day,e1[i].doj.mon,e1[i].doj.year);
}
getch();
}

No comments:

Post a Comment