公司工资管理系统C源代码Word文档格式.doc
- 文档编号:13164786
- 上传时间:2022-10-07
- 格式:DOC
- 页数:16
- 大小:56.50KB
公司工资管理系统C源代码Word文档格式.doc
《公司工资管理系统C源代码Word文档格式.doc》由会员分享,可在线阅读,更多相关《公司工资管理系统C源代码Word文档格式.doc(16页珍藏版)》请在冰豆网上搜索。
//用来存放职务
charbumen[N];
//用来存放所在部门
longid;
//用来存放编号
floatpaid;
//用来存放工资
inttotal;
//用来存放总工资
structstudent*next;
};
//-------------->
职工类
classInformation
public:
student*creat();
//建立链表
voidoutput(student*head);
//显示职工信息
intcount(student*head);
//定义函数count()统计职工总数
student*insert(student*head);
//指针函数*insert()用来添加职工信息.
student*cancel(student*head,longid);
//指针函数*cancel()用来删除职工信息.
student*find(student*head,longid);
//指针函数*find()用来查找职工信息.
student*modify(student*head,longid);
//指针函数*modife()用来修改职工的信息.
voidpaixu(student*head);
//定义paixu()函数将职工的总额从大到小排列并输出
voidaverage(student*head);
//定义职工工资平均值的函数
voidsave(student*head);
//保存文件信息
student*Read();
//读取文件信息
private:
student*p1,*p2,*p3,*head,st;
//------------>
建立链表信息
student*Information:
:
creat(void)
{//定义一个指向structstudent的结构体指针函数*creat()用来录入职工信息.
charch[N];
n=0;
//用来存放职工姓名
p1=p2=(student*)malloc(LEN);
//调用malloc()函数用来开辟一个新的存储单元
cout<
<
"
-------------<
请建立职工信息表,在姓名处键以#结束输入!
>
--------------"
endl;
姓名:
;
cin>
ch;
head=NULL;
//给指针head赋初值
while(strcmp(ch,"
#"
)!
=0)
{//调用字符比较函数strcmp()用来判断是否继续输入
p1=(student*)malloc(LEN);
//调用malloc()函数用来开辟一个新的存储单元
strcpy(p1->
name,ch);
//将循环结构前面输入的姓名复制到结构体名为p1的数组name中
cout<
性别:
cin>
p1->
sex;
编号:
id;
while((p1->
id)<
0||(p1->
id)>
100000)//判断输入的编号是否有效(100000个)
{
cout<
对不起您的输入错误!
请重新输入(>
0<
1000000):
"
cin>
}
所在部门:
bumen;
请选择级别:
1.经理"
2.技术人员"
3.销售人员"
4.销售经理"
intxuanze;
xuanze;
switch(xuanze)
{
case1:
floatwage1;
cout<
请输入级别:
cin>
zhiwu;
请输入经理的工资:
wage1;
p1->
paid=wage1;
break;
case2:
intworktime;
intwage2;
cout<
请输入技术人员的工作时间:
worktime;
请输入技术人员每小时的工资:
wage2;
paid=worktime*wage2;
case3:
intwage3;
doubleticheng3;
cout<
请输入当月销售额:
cin>
wage3;
cout<
请输入提成比例:
ticheng3;
p1->
paid=wage3*ticheng3;
case4:
intwage4;
doubleticheng4;
intgongzi;
cout<
cin>
cout<
请输入销售经理的固定工资:
gongzi;
wage4;
ticheng4;
p1->
paid=gongzi+wage4*ticheng4;
break;
if(n==0)head=p1;
//如果是输入第一组职工信息就将指针p1赋给指针head
elsep2->
next=p1;
//否则将p1赋给p2所指结构体的next指针
p2=p1;
//将指针p1赋给指针p2
n++;
//将职工人数n的值加1
\n姓名:
//将输入的姓名存放到字符数组ch中
}
p2->
next=NULL;
//将p2所指结构体的next指针重新赋空值
return(head);
//将输入的第一组职工信息返回
}
//--------------->
定义output()函数将职工的信息从头指针所指内容开始输出
voidInformation:
output(student*head)
system("
cls"
);
if(head==NULL)cout<
这是一个空表,请先输入职工信息!
\n"
else{
-------------------------------------------------------------------------------\n"
*职工工资信息表*\n"
|编号||姓名||性别||所在部门||级别||工资|\n"
p1=head;
//将头指针赋给p
do
{
cout<
setw(6)<
id<
setw(10)<
name<
sex<
bumen<
zhiwu<
paid<
p1=p1->
next;
//将下一组职工信息的next指针赋给p
}while(p1!
=NULL);
//若指针p非空则继续,目的是把所有的职工信息都传给指针p然后输出.
}
//------------>
统计职工人数的函数
intInformation:
count(structstudent*head)//定义函数count()统计职工总数
if(head==NULL)return(0);
//若指针head为空返回值为0
elsereturn(1+count(head->
next));
//函数的递归调用
添加职工的工资的函数
insert(student*head)
//插入新结点定义一个指向structstudent的结构体指针函数*insert()用来添加职工信息.
cout<
\t----------------<
请输入新增职工成绩信息>
----------------\n"
p1=(student*)malloc(LEN);
//使p1指向插入的新结点
cin>
while((p1->
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 公司 工资管理 系统 源代码
![提示](https://static.bdocx.com/images/bang_tan.gif)