人事管理系统C 源代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
#include "stdio.h" /*标准输入输出函数库*/
#include "stdlib.h" /*标准函数库*/
#include "string.h" /*字符串函数库*/
#include "conio.h" /*屏幕操作函数库*/
#define HEADER1 " -------------------------------RSDA---------------------------------------- \n"
#define HEADER2 "| number| name | jbgz | jj | kk | yfgz | sk | sfgz | \n"
#define HEADER3 "|--------|-----------|--------|--------|--------|--------|--------|--------| \n"
#define FORMAT "|%-8s|%-10s |%8.2f|%8.2f|%8.2f|%8.2f|%8.2f|%8.2f| \n" #define DATA p->num,p->name,p->jbgz,p->jj,p->kk,p->yfgz,p->sk,p-
>sfgz
#define END "---------------------------------------------------------------------------- \n"
#define N 60
int saveflag=0; /*是否需要存盘的标志变量*/
/*定义与职工有关的数据结构*/
typedef struct employee /*标记为employee*/
{
char num[10]; /*职工编号*/
char name[15]; /*职工姓名*/
float jbgz; /*基本工资*/
float jj; /*奖金*/
float kk; /*扣款*/
float yfgz; /*应发工资*/
float sk; /*税款*/
float sfgz; /*实发工资*/
}RSDA;
void menu() /*主菜单*/
{
system("cls"); /*调用DOS命令,清屏.与clrscr()功能相同*/
printf(" The Employee Management System \n");
printf("
*************************Menu********************************\n");
printf(" * 1 input record 2 delete record *\n");
printf(" * 3 search record 4 modify record *\n");
printf(" * 5 insert record 6 count record *\n");
printf(" * 7 sort record 8 save record *\n");
printf(" * 9 display record 0 quit system *\n");
printf("
*************************************************************\n");
/*printf()送格式化输出至屏幕中*/
}
void printheader() /*格式化输出表头*/
{
printf(HEADER1);
printf(HEADER2);
printf(HEADER3);
}
void printdata(RSDA pp) /*格式化输出表中数据*/
{
RSDA* p;
p=&pp;
printf(FORMAT,DATA);
}
void Disp(RSDA tp[],int n) /*显示数组tp[]中存储的记录,内容为employee 结构中定义的内容*/
{
int i;
if(n==0) /*表示没有职工工资记录*/
{
printf("\n=====>Not employee record!\n");
while(getchar()!='\n')
continue;
getchar();
}
printf("\n\n");
printheader(); /*输出表格头部*/
i=0;
while(i { printdata(tp[i]); i ; printf(HEADER3); } while(getchar()!='\n') continue; getchar(); } void Wrong() /*输出按键错误信息*/ { printf("\n\n\n\n\n***********Error:input has wrong! press any key to continue**********\n"); while(getchar()!='\n') continue; getchar(); } void Nofind() /*输出未查找到此职工的信息*/ { printf("\n=====>Not find this employee record!\n"); } /************************************************************* 作用:用于定位数组中符合要求的记录,并返回保存该记录的数组元素下标值 参数:findmess[]保存要查找的具体内容; nameornum[]保存按什么在数组中查找**************************************************************/ int Locate(RSDA tp[],int n,char findmess[],char nameornum[]) { int i=0; if(strcmp(nameornum,"num")==0) /*按职工编号查询*/ { while(i