#include <stdio.h>
#include "my_struct.h"
#include <locale.h>
#define DEBUG 1
#ifndef MY_STRUCT
#define MY_STRUCT
#endif
void autoFill(Department * a);
int main()
{
int m1, y1, m2, y2, w;
Department a[20];
int size, i = 0;
#if DEBUG
autoFill(a);
size = 3;
#else
printf("input array size <= 20\n");
scanf("%d", &size);
userFill(a, size);
#endif
printf("interval: year, month, amount of workers\n");
scanf("%d %d %d %d %d", &y1, &m1, &y2, &m2, &w);
for(i=0;i<size;i++)
{
if(a[i].organise.year==y1 && a[i].organise.year==y2)
{
if(a[i].organise.month>=m1 && a[i].organise.month<=m2)
{
if(a[i].divisionp.amount==w)
printf("%s", a[i].divisionp.surname);
}
}
else if(a[i].organise.year>y1 && a[i].organise.year<y2){
if(a[i].divisionp.amount==w)
printf("%s\n", a[i].divisionp.surname);}
//else printf("no person");
}
return 0;
}
void autoFill(Department * a)
{
struct name go1 = {"Otdel1"};
struct division wo1 = {20, "Ivanov"};
struct date ro1 = {2017,01};
a[0].fname = go1;
a[0].divisionp = wo1;
a[0].organise = ro1;
struct name go = {"Otdel2"};
struct division wo = {20, "Ivanov1"};
struct date ro = {2005,05};
a[1].fname = go;
a[1].divisionp = wo;
a[1].organise = ro;
struct name go2 = {"Otdel3"};
struct division wo2 = {20, "Ivanov2"};
struct date ro2 = {1999,03};
a[2].fname = go2;
a[2].divisionp = wo2;
a[2].organise = ro2;
struct name go3 = {"Otdel4"};
struct division wo3 = {20, "Ivanov3"};
struct date ro3 = {1999,06};
a[3].fname = go3;
a[3].divisionp = wo3;
a[3].organise = ro3;
}