C语言职工管理系统源代码及运行截图(简单版)
#include
#include
#define N 100
typedef struct worker
{
char name[20];
long number;
int y,m,d;
char zhicheng[20];
char bumen[20];
float salary;
}Worker;
void Display()
{
printf("\n\n\n\t\t***************职工管理系统*************\n\n");
printf("\t\t\t0.退\t\t 出\n");
printf("\t\t\t1.新\t\t 建\n");
printf("\t\t\t2.显\t\t 示\n");
printf("\t\t\t3.查\t\t 询\n");
printf("\t\t\t4.删\t\t 除\n\n");
}
/*******1.新 建**********/
void Add( Worker w[],int n)
{
int i;
printf("\t姓名\t工号\t进场时间\t职称\t部门\t工资\n\n");
for(i=0;i< n;i++)
{
printf("员工%d: ",i+1);
scanf("%s %ld %d %d %d %s %s %f",w[i].name,&w[i].number,
&w[i].y,&w[i].m,&w[i].d,w[i].zhicheng,w[i].bumen,&w[i].salary);
}
}
/*******2.显 示**********/
void Browse( Worker w[],int n )
{
int i;
printf("\t姓名\t工号\t进场时间\t职称\t部门\t工资\n\n");
for(i=0;i< n;i++)
{
printf("员工%d:",i+1);
printf("%s\t%ld\t%d-%d-%d\t%s\t%s\t%f\n\n",w[i].name,w[i].number,w[i].y,w[i].m,w[i].d,w[i].zhicheng,w[i].bumen,w[i].salary);
}
}
/*******3.1查询姓名**********/
void SearchName( Worker w[],int n )
{
char name[20];
int i;
printf("\t\t\t输入要查询的名字:");
scanf("%s",name);
for( i = 0; i < n; i ++ )
{
if( strcmp( w[i].name,name ) == 0 )
{
printf("\n\t\t\t查得信息如下:\n\n");
printf("姓名\t工号\t进场时间\t职称\t部门\t工资\n\n");
printf("%s\t%ld\t%d-%d-%d\t%s\t%s\t%f\n\n",w[i].name,w[i].number,w[i].y,w[i].m,w[i].d,w[i].zhicheng,w[i].bumen,w[i].salary);
return;
}
}
printf("\t\t\t查无此人!");
}
/*******3.2查询工号**********/
void SearchNumber( Worker w[],int n )
{
long number;
int i,k=0;
printf("\t\t\t输入要查询的工号:");
scanf("%ld",&number);
for( i = 0; i < n; i ++ )
{
if( w[i].number == number )
{
printf("\n\t\t\t查得信息如下:\n\n");
printf("姓名\t工号\t进场时间\t职称\t部门\t工资\n\n");
printf("%s\t%ld\t%d-%d-%d\t%s\t%s\t%f\n\n",w[i].name,w[i].number,w[i].y,w[i].m,w[i].d,w[i].zhicheng,w[i].bumen,w[i].salary);
return;