C工资管理系统源代码Word下载.docx

上传人:b****6 文档编号:17278031 上传时间:2022-11-30 格式:DOCX 页数:19 大小:17.55KB
下载 相关 举报
C工资管理系统源代码Word下载.docx_第1页
第1页 / 共19页
C工资管理系统源代码Word下载.docx_第2页
第2页 / 共19页
C工资管理系统源代码Word下载.docx_第3页
第3页 / 共19页
C工资管理系统源代码Word下载.docx_第4页
第4页 / 共19页
C工资管理系统源代码Word下载.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

C工资管理系统源代码Word下载.docx

《C工资管理系统源代码Word下载.docx》由会员分享,可在线阅读,更多相关《C工资管理系统源代码Word下载.docx(19页珍藏版)》请在冰豆网上搜索。

C工资管理系统源代码Word下载.docx

voidmenu();

PAY*input();

voidoutput();

voidsave(PAY*head);

PAY*open();

PAY*insert();

voidsearch();

PAY*del();

PAY*revise();

/*主程序模块*/

voidmain(void)

shortsel;

do

{

menu();

scanf("

%d"

&

sel);

switch(sel)

case1:

head=input();

//输入模块

break;

case2:

head=insert();

//插入模块

case3:

head=revise();

//修改模块

case4:

head=del();

//删除模块

case5:

search();

//查找模块

case6:

output();

//输出模块

case7:

save(head);

//保存模块

case0:

}

}while(sel!

=0);

}

/*菜单*/

voidmenu()

printf("

\n\n\n\n\n\n\n"

);

\t\t\t\t*主菜单选项*\n\n"

\t\t\t\t1.创建工资档案\n"

\t\t\t\t2.新增工资信息\n"

\t\t\t\t3.修改工资信息\n"

\t\t\t\t4.删除工资信息\n"

\t\t\t\t5.查找工资信息\n"

\t\t\t\t6.分类信息列表\n"

\t\t\t\t7.保存信息\n"

\t\t\t\t0.退出\n"

\n\n\n\n\n\n\n\n"

/*输入模块*/

PAY*input()

shortn=1;

p1=(PAY*)malloc(sizeof(PAY));

if(p1==NULL)

内存不足,无法创建链表!

"

getch();

\n请输入第%d位职工的信息(以工号为0结束):

\n"

n);

工号:

p1->

num);

if(p1->

num==0)

按任意键返回!

free(p1);

return0;

getchar();

姓名:

gets(p1->

name);

工资月份:

month);

岗位工资,技能工资,职务津贴,职龄津贴,交通补贴,业绩津贴:

%f,%f,%f,%f,%f,%f"

gw,&

jn,&

zw,&

zl,&

jt,&

yj);

房租扣款,公积金,水电费,其它扣款:

%f,%f,%f,%f"

fz,&

gj,&

sd,&

others);

p1->

should_pay=p1->

gw+p1->

jn+p1->

zw+p1->

zl+p1->

jt+p1->

yj;

rebate=p1->

fz+p1->

gj+p1->

sd+p1->

others;

actual_pay=p1->

should_pay-p1->

rebate;

while(p1!

=NULL)

if(n==1)

head=p1;

else

p2->

next=p1;

n++;

p2=p1;

请输入第%d位职工的信息(以工号为0结束):

p1=NULL;

next=NULL;

//editbyYan-XingyuClassNetwork-021

职工信息已输入,请按任意键返回,并存盘……"

returnhead;

/*输出模块*/

voidoutput()

shortsel,flag,month;

floatmin,max;

\n\n请选择您的列表方式:

\t\t1.全部清单\n"

\t\t2.按月输出\n"

\t\t3.按工资段输出\n"

\t\t0.返回\n"

=1&

&

sel!

=2&

=3&

head=open();

if(head==NULL)

return;

\n\t\t\t******全部清单******\n"

printf(TITLE);

p1=head;

printf(DATA);

p1=p1->

next;

}while(p1!

=NULL);

flag=0;

输入要查的月份:

\n\t\t\t******第%d月工资清单******\n"

month);

month==month)

flag=1;

if(flag==0)

没有该月清单\n"

输入最低工资:

%f"

min);

输入最高工资:

max);

\n\t\t******%5.1f到%5.1f工资的名单******\n"

min,max);

actual_pay>

min&

actual_pay<

max)

没有该工资段的职工\n"

/*保存文件*/

voidsave(PAY*head)

shortwrite;

fp=fopen("

pay.txt"

"

w"

if(fp==NULL)

创建文件失败!

p1=p2=head;

write=fwrite(p1,sizeof(PAY),1,fp);

if(!

write)

无法写入文件!

fclose(fp);

成功存盘!

/*打开文件*/

PAY*open()

shortn=1,read;

r"

无法打开档案文件!

returnNULL;

if((p1=p2=(PAY*)malloc(sizeof(PAY)))==NULL)

内存不足!

read=fread(p1,sizeof(PAY),1,fp);

read)

文件读取出错!

1"

next==NULL)

if((p1=(PAY*)malloc(sizeof(PAY)))==NULL)

2"

}while(p1->

next!

/*插入模块*/

PAY*insert()

PAY*p3=NULL;

charsel;

请输入要插入的职工信息:

p3=(PAY*)malloc(sizeof(PAY));

if(p3==NULL)

p3->

gets(p3->

p3->

should_pay=p3->

gw+p3->

jn+p3->

zw+p3->

zl+p3->

jt+p3->

rebate=p3->

fz+p3->

gj+p3->

sd+p3->

actual_pay=p3->

should_pay-p3->

next=p3;

成功插入,是否继续?

是(Y)否(N)\n"

sel=getch();

}while(sel=='

Y'

||sel=='

y'

\n任意键返回,并存盘……\n"

/*查找模块*/

voidsearch()

charname[20],choose;

\n选择查找方式:

\t\t1.按工号查找\n"

\t\t2.按姓名查找\n"

=2);

输入要查的工号:

%ld"

输入要查的姓名:

gets(name);

while((p1->

=NULL)&

(p1->

num!

=num)&

(strcmp(p1->

name,name)!

=0))//用成p1!

=NULL有问题?

if((p1->

num==num)||strcmp(p1->

name,name)==0)

您要查找的信息如下:

没有该信息!

是否继续?

choose=getch();

}while(choose=='

||choose=='

任意键返回"

/*删除模块*/

PAY*del()

\n选择删除方式:

\t\t1.按工号删除\n"

\t\t2.按姓名删除\n"

输入要删除的工号:

输入要删除的姓名:

head=p1->

删除信息成功!

=0))

next=p1->

\n删除信息成功!

\n没有该信息!

任意键返回,并存盘……"

/*修改模块*/

PAY*revise()

\n查找要修改的对象:

您要修改的原始信息如下:

\n将上述信息改为如下信息:

你要修改的信息不存在!

任意键返回,并存盘……"

}

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 高考

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1