版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、/*程序名称:工资管理系统*/*程序说明:该系统在磁盘上储存了某单位上月全体员工的工资信息,对于每一位职工存储以下信息:月份,职工编号,基本工资,津贴,岗贴,补贴,房贴,交通补贴,应发数,房租,储蓄, 会费,个人所得税,应扣数,实发数。个人所得税计算方法设定为:工资少于800元为0,800-1000元的部分为5%, 1000-5000元的部分为10%,5000元以上的部分为 20%。该系统功能如下:1 )创建存储职工工资信息的存储系统。2)添加职工的工资信息(增加新职工时用)3 )删除某职工的工资信息(职工离职或者死亡时用)4)修改某职工的部分工资信息(当月开始增加或减少某些项工资或扣款数变化
2、)5 )输出指定编号职工的工资信息(查询用)6 )输出当月全体职工的工资信息(发工资用)*/*编写心得:2006年9月26日19:30-23:00 共计3小时30分钟。由于时间仓促,没有对代码进行优化设计。对于主要的结构体也是粗粗设计了一下。在存储上只采用了结构体数组,没用运用到二叉树等复杂的数据结构,有点遗憾。主程序采用模块化设计,用独立的函数把功能分解开来,便于调试和扩展。假如用C+就可以多做几个构造函数,可能会更方便点。不过最近在学JAVA,不敢乱用C+ 了,怕到时候知识搞混了。感觉稍微麻烦一点的地方是文件的输入输出部分,因为一般的书上这一章都比较靠后,老师上课也就简单的带过的,格式有点
3、忘记了。个人感觉现在靠 C语言来做数据库不是很合适,50个元素的数组应该够了吧。反正只要弄清那些常用函数,还有怎么一个I/O方式就可以了。让偶想起了教偶C语言的班主任老童,想起了偶美好的青春,以及那些为了听课和MM们一大早抢前排坐位的幸福日子总得来说还是比较轻松的,就是项目字段太多,写写麻烦(谁叫偶打字不快啊A_A)BY雨田心梦*/*为了调用FILE等函数*/#i nclude "stdio.h"#i nclude "con io.h"/*为了调用atof()等函数*/#in clude "stdlib.h"#defi ne TRUE
4、 1/*结构体声明*/struct zhigo ngint mon th;float id;float jbgz;float jt;float gt;float bt;float ft;float jtbt;float yfs;float fz;float ex;float hf;float grsds;float yks;float sfs;/*建立50个元素的结构体数组 */struct zhigo ng zg50;/*建立结构体变量*/struct zhigo ng zgone;/*职员列表中的数量 */int n=0;/*获得字符串 */char nu mstr50;main ()ch
5、ar ch;n=0;/*rfile(); 使用后启动程序时系统会自动加载纪录*/while(TRUE)prin tf("n");prin tf(”=prin tf("Welcome!Please choice(1-6):printf("1.Add one infomationprintf("2.Delete one infomationprintf("3.Modify one infomationprintf("4.Print out by idprintf("5.Print out allprintf("
6、;6.Save dateprin tf("7.Load dateprin tf("8.Exitprintf(”ch=getche();n")+n ”);+n");+n");+n");+n");+n");+n ”);+n");+n");n")switch(ch)case '1':addo ne();break;case 2:del on e();break;case 3:modo ne();break;case '4':ido ne();break;cas
7、e '5':listall();break;case '6':wfile();break;case '7':rfile();break;case '8':retur n;default:pri ntf("Sorry,please choice aga in!n");/*计算个人所得税*/float tgrsds(float m)float sui1,sui2,sui3;float tmp;sui1=0;sui2=0;sui3=0;if(m>=5000)sui1=(m-5000)*0.2;sui2=(500
8、0-1000)*0.1;sui3=(1000-800)*0.05;else if(m>=1000 && m<5000)sui2=(m-1000)*0.1;sui3=(1000-800)*0.05;else if(m>=800 && m<1000)sui3=(m-800)*0.05;tmp=sui1+sui2+sui3;return(tmp);/*添加职工的工资信息*/addo ne(void)prin tf("n");prin tf("Record NO. %d n", n+1);prin tf(&
9、quot;Please put in mon th: n");gets( nu mstr);zg n.m on th=atoi( nu mstr);prin tf("Please put in zhigo ngbia nhao: n");gets( nu mstr);zg n.id=atof( nu mstr);prin tf("Please put in jibe ngon gzi: n ”);gets( nu mstr);zg n.jbgz=atof( nu mstr);prin tf("Please put in jin tie: n&q
10、uot;);gets( nu mstr);zg n.jt=atof( nu mstr);prin tf("Please put in gan gtie: n");gets( nu mstr);zg n.gt=atof( nu mstr);prin tf("Please put in butie: n");gets( nu mstr);zg n.bt=atof( nu mstr);prin tf("Please put in fan gtie: n");gets( nu mstr);zg n.ft=atof( nu mstr);prin
11、 tf("Please put in jiaot on gbutie: n");gets( nu mstr);zg n.jtbt=atof( nu mstr);zg n .yfs=(zg n.jbgz)+(zg n.jt)+(zg n.gt)+(zg n.bt)+(zg n.ft)+(zg n.jtbt); prin tf("Please put in fan gzu: n ”);gets( nu mstr);zg n.fz=atof( nu mstr);prin tf("Please put in chuxu: n ”);gets( nu mstr);
12、zg n.cx=atof( nu mstr);prin tf("Please put in huifei: n ”);gets( nu mstr);zg n.hf=atof( nu mstr);zg n.grsds=tgrsds(zg n.yfs);zg n.yks=(zg n.fz)+(zg n.cx)+(zg n.hf)+(zg n.grsds);zg n.sfs=(zg n.yfs)-(zg n.yks);n+;/*删除个人纪录*/del on e(void)struct zhigo ng tmp50; float zhigo ngid;int j,k;int flagfi n
13、d;flagfi nd=0;k=0;prin tf("n Please put in zhigo ngbia nhao: n"); gets( nu mstr);zhigo ngid=atof( nu mstr);for(j=0;j<=n ;j+)if(zgj.id=zhigo ngid)flagfi nd=1;elsetmpk=zgj;k+;if(flagfi nd=1)for(j=0;j<=( n-1);j+)zgj=tmpj;prin tf("n Record deleted! n");n=n-1;elseprin tf("n
14、 Record not found! n ”);return;/*修改个人纪录*/modo ne(void)float zhigo ngid;int j;int flagfi nd;flagfi nd=0;prin tf("n Please put in zhigo ngbia nhao: n"); gets( nu mstr);zhigo ngid=atof( nu mstr);for(j=0;j<=n ;j+)if(zgj.id=zhigo ngid)prin tf("NO.:%dn",j);prin tf("mo nth:%din&
15、quot; ,zgj.mo nth);prin tf("zhigo ngbia nhao%10.0fn",zgj.id);prin tf("jibe ngo ngzi:%10.2fn",zgj.jbgz);prin tf("Please put in jibe ngon gzi: n ”); gets( nu mstr);zgj.jbgz=atof( nu mstr);prin tf("ji ntie:%10.2fn",zgj.jt);prin tf("Please put in jin tie: n")
16、; gets( nu mstr);zgj.jt=atof( nu mstr);prin tf("ga ngtie:%10.2fn",zgj.gt);prin tf("Please put in gan gtie: n"); gets( nu mstr);zgj.gt=atof( nu mstr);prin tf("butie:%10.2fn",zgj.bt);prin tf("Please put in butie: n");gets( nu mstr);zgj.bt=atof( nu mstr);prin tf(
17、"fa ngtie:%10.2fn",zgj.ft);prin tf("Please put in fan gtie: n");gets( nu mstr);zgj.ft=atof( nu mstr);prin tf("jiaoto ngbutie:%10.2fn",zgj.jtbt);prin tf("Please put in jiaot on gbutie: n");gets( nu mstr);zgj.jtbt=atof( nu mstr);zgj.yfs=(zgj.jbgz)+(zgj.jt)+(zgj.
18、gt)+(zgj.bt)+(zgj.ft)+(zgj.jtbt);prin tf("fa ngzu:%10.2fn",zgj.fz);prin tf("Please put in fan gzu: n ”);gets( nu mstr);zgj.fz=atof( nu mstr);prin tf("chuxu:%10.2fn",zgj.cx);prin tf("Please put in chuxu: n ”);gets( nu mstr);zgj.cx=atof( nu mstr);prin tf("huifei:%10.
19、2fn" ,zgj.hf);prin tf("Please put in huifei: n ”);gets( nu mstr);zgj.hf=atof( nu mstr);zgj.grsds=tgrsds(zgj.yfs);zgj.yks=(zgj.fz)+(zgj.cx)+(zgj.hf)+(zgj.grsds);zgj.sfs=(zgj.yfs)-(zgj.yks);flagfi nd=1;elseflagfi nd=0;if(flagfi nd=O)pri ntf("n Can not find record! n");return;/*随机从内
20、存中查找纪录根据 id*/idon e(void)卄rRsIf劉勺變MX0S6Z-4cxloL%mxnlp=c_d Jz二=6N=cxloL%mz6u45=c_d MSMS6N&0L%mlls456UK-=c_d -aq 二S6NRoL%lnq6uoloQEc_d es6z-=-4cxloL%o)u45=c_d gqs6z-=-&OL%lnq=c_d Mo)s6z-=- &0L%o)ue6=c_d ES6Z-&OL%lucizu_d MZ62S6Z-RoL%._z6u06ueqcizu_d MPs6z-=-40oL%oeLIUQq6uo6_llz=c_d M
21、163;uolus6z-=- p%wuolu=c_d -(L+r=- u 二 Puno4 POO2 p% urfuK(P_6UO6ZZUUP-=6Z)七(+ruuvoUD04Slunu=oroup-6UO6ZZMslunu)so6M-S0elluQq6u06zz u 二 nd se -d urfuKOHPUW 舉-puu=6e_二 u 一iru 一 P6UO6ZZrooq=POMprin tf("huifei:%10.2f |",zgj.hf);prin tf("gere nsuodeshui:%10.2f |",zgj.grsds);prin tf(&
22、quot;yi ngkoushu:%10.2f |" ,zgj.yks);prin tf("shifashu:%10.2fn",zgj.sfs);flagfi nd=1;elseflagfi nd=0;if(flagfind=0)printf("n Can not find record! n"); return;/*输出当月全体职工的工资信息*/listall(void)int j;if(n<1)-ss6z-=uvcxloL%mlls 旦 i|S一MS±As6z-=- RoL%mllsno±6u_AMSPS6s6z-=- 4cxloL%._nlls ponsuai 6_二 LIs6N=-RoL%=9_nllMXOs6z-=cxloL%mxnlpJz二=6z-=cxloL%mz6ueM-MSMS6N&OL%mlls456u_A-aq 二S6NRoL%lnq6uoloQes6z-=cxloL%o)ueM-gqs6z-=-RoL%lnqMo)s6z-=-&0L%o)uges6z-=-rol%1u_MZ62S6Z-RoL%._z6u06ueq_MPs6z-=-40oL%oeLIUQq6uo6_ll_Nm£uoes6z-=- p%wuoe-(L+r
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026山东菏泽特殊教育职业学校招聘2人笔试备考题库及答案解析
- 中国建筑一局(集团)有限公司东北分公司2026届校园招聘考试模拟试题及答案解析
- 2026贵州黔西南州贞丰坎贝尔医院招聘3人笔试参考题库及答案解析
- 2026上海市荣誉军人疗养院工作人员公开招聘考试模拟试题及答案解析
- 2025福建厦门储备粮集团招聘笔试历年难易错考点试卷带答案解析
- 2025江苏省国药控股扬州有限公司招聘1人笔试历年典型考点题库附带答案详解
- 2025广西来宾产业投资集团有限公司社会招聘17人笔试历年难易错考点试卷带答案解析
- 2025广东东莞市大岭山实业发展有限公司招聘副总经理拟聘人员笔试历年常考点试题专练附带答案详解
- 2025年滨州国有资本投资运营集团有限公司公开招聘(28人)笔试历年难易错考点试卷带答案解析
- 2025年合肥某国有企业(岗位外包)招聘1名笔试历年难易错考点试卷带答案解析
- 雷达站管理制度
- 化工原料仓储与调度智能管理系统评估报告
- 安全生产等12项管理制度文本
- DB33∕T 2476-2022 长期护理保障失能等级评估规范
- 2026年国家电网招聘之财务会计类考试题库500道含答案【完整版】
- 2024贵州自然资源厅所属事业单位招聘考试真题
- 小学数学一年级下册列竖式计算60套
- 巡游出租车培训课件
- 中药热奄包治疗
- 非复杂性尿路感染诊疗指南
- 生育保险政策讲解
评论
0/150
提交评论