统计员工信息程序做?
按年龄,性别,工作统计员工信息,请问各位我的这个程序该怎么改?#include <stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 100
char filename[20];
FILE *fp;
struct date
{int year;
int mouth;
int day;
};
struct person
{ char name[10];
int age;
char job[10];
char sex[10];
char address[10];
char phone[10];
struct date in_time;
}worker[MAX];
void count_age( )
{int i,j,n;
int agekey;
n=65;
j=0;
system("CLS");
printf("******输入要统计员工的年龄******\n");
scanf("%d",&agekey);
for(i=0;i<n;i++)
if(worker[i].age==agekey)
{printf("******员工信息******\n");
printf("姓名\t年龄\t性别\t地址\t电话\t入厂时间\n");
printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d\n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,
worker[i].in_time.year,worker[i].in_time .mouth ,worker[i].in_time.day );
}
else j++;
if(j==n)
printf("******暂无该年龄段员工******\n");
printf("******按任意键返回主菜单******\n");
getchar();
}
void count_job(int n)
{ int i,j; char jobkey[10];
j=0;
system("CLS");
printf("******输入要统计员工的职务******\n");
scanf("%s",&jobkey);
for(i=0;i<n;i++)
if(strcmp(worker[i].job,jobkey)==0)
{printf("******员工信息******\n");
printf("姓名\t年龄\t工作\t性别\t地址\t电话\t入厂时间\n");
printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d\n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address ,worker[i].phone ,
worker[i].in_time.year ,worker[i].in_time.mouth ,worker[i].in_time.day );
}
else j++;
if(j==n)
printf("******暂无该职务或该职务暂无人******\n");
printf("******按任意键返回主菜单******\n");
getchar();
}
void count_sex(int n)
{int i,j,n;char sexkey[10];
j=0;
system("CLS");
printf("******输入要统计员工的性别******\n");
scanf("%s",&sexkey);
for(i=0;i<n;i++)
if(strcmp(worker[i].sex,sexkey)==0)
{ printf("******员工信息******\n");
printf("姓名\t年龄\t工作\t性别\t地址\t电话\t入厂时间\n");
printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d\n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address ,worker[i].phone ,
worker[i].in_time.year ,worker[i].in_time.mouth ,worker[i].in_time.day );
}
else j++;
if(j==n)
printf("******暂无该性别员工******\n");
printf("******按任意键返回主菜单******\n");
getchar();
}
void count()
{int i;
do
{system("CLS");
printf("\n\n\n******统计员工信息******\n\n");
printf(" 按1,统计某年龄职工.\n\n");
printf(" 按2,统计某职务职工.\n\n");
printf(" 按3,统计某性别职工.\n\n");
printf(" 按0,返回主菜单.\n\n");
printf(" 请选择(0-3):\n");
scanf("%d",&i);
switch(i)
{case 1:count_age();break;
case 2:count_job();break;
case 3:count_sex();break;
case 0:break;
default:printf("输入错误\n");
}
}while(i!=0);
}