公司工资管理系统(C++源代码)

上传人:油条 文档编号:107563262 上传时间:2019-10-20 格式:DOC 页数:16 大小:87KB
返回 下载 相关 举报
公司工资管理系统(C++源代码)_第1页
第1页 / 共16页
公司工资管理系统(C++源代码)_第2页
第2页 / 共16页
公司工资管理系统(C++源代码)_第3页
第3页 / 共16页
公司工资管理系统(C++源代码)_第4页
第4页 / 共16页
公司工资管理系统(C++源代码)_第5页
第5页 / 共16页
点击查看更多>>
资源描述

《公司工资管理系统(C++源代码)》由会员分享,可在线阅读,更多相关《公司工资管理系统(C++源代码)(16页珍藏版)》请在金锄头文库上搜索。

1、#include #include #include #include #include #include #define NULL 0int const N=20;#define LEN sizeof(struct student)using namespace std;void Menu();void Pass();int n=0; /定义一个全局变量统计职工人数/-定义一个职工信息的结构体struct studentchar nameN; /用来存放姓名char sexN; /用来存放性别char zhiwuN; /用来存放职务char bumenN; / 用来存放所在部门long id

2、; /用来存放编号float paid; /用来存放工资int total; /用来存放总工资struct student *next;/-职工类class Information public: student *creat(); /建立链表 void output(student *head); /显示职工信息 int count(student *head); /定义函数count()统计职工总数 student *insert(student*head); /指针函数*insert()用来添加职工信息. student *cancel(student *head,long id); /

3、指针函数*cancel()用来删除职工信息. student *find(student *head,long id); /指针函数*find()用来查找职工信息. student *modify(student *head,long id); /指针函数*modife()用来修改职工的信息. void paixu(student *head); /定义paixu()函数将职工的总额从大到小排列并输出 void average(student *head); /定义职工工资平均值的函数 void save(student *head); /保存文件信息 student *Read(); /读取

4、文件信息 private: student *p1,*p2,*p3,*head,st; /-建立链表信息student *Information:creat(void)/定义一个指向struct student 的结构体指针函数*creat()用来录入职工信息. char chN;n=0; /用来存放职工姓名 p1=p2=(student *)malloc(LEN);/调用malloc()函数用来开辟一个新的存储单元 cout -endl; coutch; head=NULL; /给指针head 赋初值 while (strcmp(ch,#)!=0) /调用字符比较函数strcmp()用来判断

5、是否继续输入 p1=(student *)malloc(LEN); /调用malloc()函数用来开辟一个新的存储单元 strcpy(p1-name,ch); /将循环结构前面输入的姓名复制到结构体名为p1 的数组name 中 coutp1-sex; coutp1-id; while(p1-id)id)100000) /判断输入的编号是否有效(100000个) cout0p1-id; coutp1-bumen; cout 请选择级别:endl; cout 1.经理endl; cout 2.技术人员endl; cout 3.销售人员endl; cout 4.销售经理xuanze; switch(

6、xuanze) case 1: float wage1; cout请输入级别:p1-zhiwu; cout请输入经理的工资:wage1; p1-paid=wage1; break; case 2: int worktime; int wage2; cout请输入级别:p1-zhiwu; cout请输入技术人员的工作时间:worktime; cout请输入技术人员每小时的工资:wage2; p1-paid=worktime*wage2; break; case 3: int wage3; double ticheng3; cout请输入级别:p1-zhiwu; cout请输入当月销售额:wage

7、3; cout请输入提成比例:ticheng3; p1-paid=wage3*ticheng3; break; case 4: int wage4; double ticheng4; int gongzi; cout请输入级别:p1-zhiwu; cout请输入销售经理的固定工资:gongzi; cout请输入当月销售额:wage4; cout请输入提成比例:ticheng4; p1-paid=gongzi+wage4*ticheng4; break; if(n=0)head=p1; /如果是输入第一组职工信息就将指针p1 赋给指针head else p2-next=p1; /否则将p1 赋给

8、p2 所指结构体的next 指针 p2=p1; /将指针p1 赋给指针p2 n+; /将职工人数n 的值加1 coutch; /将输入的姓名存放到字符数组ch 中 p2-next=NULL; /将p2 所指结构体的next 指针重新赋空值 return (head);/将输入的第一组职工信息返回/-定义output()函数将职工的信息从头指针所指内容开始输出void Information:output(student *head) system(cls); if(head=NULL) cout 这是一个空表,请先输入职工信息!n; else cout-n; cout *职工工资信息表*n;

9、cout-n; cout|编 号| |姓 名| |性别| |所在部门| |级别| |工资|n; cout-n; p1=head; /将头指针赋给p do coutsetw(6)idsetw(10)namesetw(10)sexsetw(10)bumensetw(10)zhiwusetw(10)paidendl; coutnext; /将下一组职工信息的next 指针赋给p while(p1!=NULL); /若指针p 非空则继续,目的是把所有的职工信息都传给指针p 然后输出./-统计职工人数的函数int Information:count(struct student *head) /定义函数count()统计职工总数 if(head=NULL)return(0); /若指针head 为空返回值为0 else return(1+count(head-next); /函数的递归调用/-添加职工的工资的函数student *Information:insert( student *head)/插入新结点定义一个指向struct student 的结构体指针函数*insert()用来添加职工信息. system(cls); coutt-nendl; p1=(student *)malloc(LEN); /使p1 指向插入的新结点 coutp1-id; while(p1-id)id)

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 其它中学文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号