by Dinesh Thakur

 
#include<stdio.h>

struct date
{
     int day,month,year;
};
     struct emp
        {
            char code[4],name[25],dep[20];
            struct date doj;
        };
void main()
   {
        struct date tdate;
        struct emp e[20];
        char ename[25];
        int i,n;
        clrscr();
        printf("\n Enter no. of employes = ");
        scanf("%d",&n);
        printf("\n Enter data");
        for(i=0;i<n;i++)
            {
                printf("\n Enter code,name,department,day,month,year of joining of %d employee \n",i+1);
                scanf("%s%s%s%d%d%d",e[i].code,e[i].name,e[i].dep, &e[i].doj.day,&e[i].doj.month,&e[i].doj.year);
            }
                printf("Enter today's date=");
                scanf("%d%d%d",&tdate.day,&tdate.month,&tdate.year);
                for(i=0;i<n;i++)
                    {
                         if((tdate.year>e[i].doj.year+1) || (tdate.year>e[i].doj.year&&((tdate.month==e[i].doj.month&&tdate.day>e[i].doj.day)||tdate.month>e[i].doj.day,e[i].doj.month)))
                           {
                              printf("\n Employee's data is:");
                              printf("%s\t%s\t%s\t%d\t%d\t%d\t",e[i].code,e[i].name,e[i].dep, e[i].doj.day,e[i].doj.month,e[i].doj.year);
                           }
                              printf("\n");
                    }
                              getch();
  } 

Write a Program to Define a Structure