C++课程设计报告Word文件下载.docx

上传人:b****6 文档编号:18633042 上传时间:2022-12-30 格式:DOCX 页数:19 大小:38.26KB
下载 相关 举报
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

2.1.2设计要求:

(1)公司主要有4类人员:

经理、技术员、销售员、销售经理。

要求存储这些人的职工号、姓名、月工资、岗位、年龄、性别等信息。

(2)工资的计算方法:

A.经理:

固定月薪为8000;

B.技术员:

工作时间*小时工资(100元每小时);

C.销售员:

销售额*4%提成;

D.销售经理:

底薪(5000)+所辖部门销售额总额*0.5%;

(3)输入数据要求每类人员不能少于4人,并按以下格式输出:

职工号姓名性别年龄岗位工资排名

(4)部门业绩表

某部门经理所辖部门各售货员的业绩及自己的工资表

(5)菜单要求:

要有一个菜单,用于选择各项功能,其中

①数据录入:

输入各种数据;

②数据统计:

各销售经理的工资计算及最终按工资进行的冒泡排序;

③数据打印:

打印上述表格;

④数据备份:

把相关数据写入文件;

⑤退出:

推出本系统;

2.2系统分析

2.2.1系统开发背景、开发范围、建设目标与必要性

随着本世纪以来科学技术的突飞猛进和社会生产力的迅速发展,人们进行信息交流的深度与广度不断增加,信息量急剧增长,传统的信息处理与决策的手段已不能适应社会的需要,信息的重要性和信息处理问题的紧迫性空前提高了,面对着日益复杂和不断发展,变化的社会环境,特别是企业间日趋剧烈的竞争形势,一个人、一个企业要在现代社会中求生存,求发展,必须具备足够的信息和强有力的信息收集与处理手段。

电子计算机以强大的信息处理能力作为人类脑力劳动的有力助手登上历史舞台以后,出现了把人类从繁琐的脑力劳动下解放出来的现代信息革命。

为了适应现代企业或公司经营发展的需要,为提高企业工作效率、保证企业职工信息管理质量、快而准确地为企业制定好的经营方针与决策,我们有必要开发一个职工工资管理系统。

2.3系统设计

2.3.1程序功能设计

职工工资管理系统功能图(3-3-1)

职工信息管理系统的功能:

(1)职工基本信息管理:

负责管理企业职工的各种基本资料,并对其进行有条理的管理,提供对基本信息的打印、添加等操作。

(2)职工工资情况管理:

负责管理职工的工资情况,同时提供对职工工资的打印、添加等操作。

(3)系统资料备份管理:

负责对系统所做的修改进行备份操作。

(4)职工工资录入管理:

完成对职工工资情况的录入,以及添加职工信息等操作。

(5)职工工资统计管理:

进行对职工工资的统计,排序以及按照部门统计等操作。

2.3.2程序运行环境

操作平台:

DOS

程序设计语言:

C++

最低配置:

CPUIntelPentiumII800M内存32MB

建立数据库表:

ManagerFile.txt(部门经理工资信息文件)

SellerFile.txt(销售员工资信息文件)

SellManagerFile.txt(销售经理工资信息文件)

TechnicianFile.txt(技术员工资信息文件)

VisualC++是一个功能强大的可视化软件开发工具。

VisualC++6.0不仅是一个C++编译器,而且是一个基于Windows操作系统的可视化集成开发环境(integrateddevelopmentenvironment,IDE)。

VisualC++6.0由许多组件组成,包括编辑器、调试器以及程序向导AppWizard、类向导ClassWizard等开发工具。

这些组件通过一个名为DeveloperStudio的组件集成为和谐的开发环境

2.4系统实施

2.4.1程序代码

#include<

iostream.h>

stdlib.h>

stdio.h>

string.h>

#defineManagerFile"

ManagerFile.txt"

#defineTechnicianFile"

TechnicianFile.txt"

#defineSellerFile"

SellerFile.txt"

#defineSellManagerFile"

SellManagerFile.txt"

//文件操作模块

FILE*fpManager,*fpTechnician,*fpSeller,*fpSellManager;

FILE*FileOpen(charFileName[])//文件打开函数

{

FILE*fp;

if((fp=fopen(FileName,"

r"

))==NULL)

{

fp=fopen(FileName,"

w"

);

cout<

<

"

文件打开失败重新创建记录文件"

;

returnfp;

}

fp=fopen(FileName,"

r+"

returnfp;

}

voidFileClose(FILE*fp)//文件关闭函数

if(fclose(fp)==0);

else

文件关闭失败"

endl;

}//类型定义模块

classStaff//职工节本信息

public:

charStaff_num[10];

//职工号

charStaff_name[10];

//姓名

intStaff_age;

//年龄

floatStaff_wages;

//月工资

charStaff_sex[2];

//性别

charStaff_department[20];

//部门职位

Staff()

cout<

endl<

请输入职工号:

cin>

>

Staff_num;

请输入姓名:

Staff_name;

请输入年龄:

Staff_age;

请输入性别:

Staff_sex;

请输入职位:

Staff_department;

voidStaffOutput()

职工号:

Staff_num<

"

Staff_name<

年龄:

Staff_age<

性别:

Staff_sex<

职位部门:

};

classManager:

publicStaff//经理

Manager()

输入经理月工资:

Staff_wages;

voidManagerOutput()

StaffOutput();

经理月工资为:

Staff_wages<

classTechnician:

publicStaff//技术员类

floathour;

//工作时间

floatwph;

//每小时工资

intday;

//每月工作天数

Technician()

请输入每天工作时间:

hour;

请输入每小时工资:

wph;

请输入每月工作天数:

day;

Staff_wages=hour*wph*day;

voidTechnicianOutput()

技术员工资为:

classSeller:

publicStaff//销售员类

floatproportion;

//提成比例

floatvolume;

//销售额

charBoss[10];

Seller()

请输入提成比例(如:

0.04):

proportion;

请输入销售额:

volume;

Staff_wages=proportion*volume;

请输入上司名称"

Boss;

voidSellerOutput()

销售员工资为:

提成比例为:

proportion<

销售额为:

volume<

上司为:

Boss<

classSellManager:

publicStaff//销售经理类

public:

floatBasicSalary;

//底薪

floatProportion;

//比例

SellManager()

请输入销售经理底薪:

BasicSalary;

请输入销售经理提成比例(如0.5):

Proportion;

fpSeller=FileOpen(SellerFile);

Seller*temp;

temp=(Seller*)malloc(sizeof(Seller));

floatsum=0;

while(fread(temp,sizeof(Seller),1,fpSeller)==1)

if(strcmp(Staff_name,temp->

Boss)==0)

sum=sum+temp->

Staff_wages=sum*Proportion+BasicSalary;

FileClose(fpSeller);

SellManagerOutput()

底薪为:

BasicSalary<

Proportion<

工资为:

//数据录入模块

intInputManager()//录入经理数据

fpManager=FileOpen(ManagerFile);

//打开经理数据文件

fseek(fpManager,0,2);

//指针移动到末尾

intchoose=1;

while

(1)

Managertemp;

fwrite(&

temp,sizeof(Manager),1,fpManager);

是否继续(1、继续0、退出)?

choose;

if(choose==0)

{

FileClose(fpManager);

return1;

intInputTechnician()//录入经理数据

fpTechnician=FileOpen(TechnicianFile);

fseek(fpTechnician,0,2);

Techniciantemp;

temp,sizeof(Technician),1,fpTechnician);

FileClose(fpTechnician);

intInputSeller()//录入经理数据

fpSeller=FileOpen(SellerFile);

fseek(fpSeller,0,2);

Sellertemp;

temp,sizeof(Seller),1,fpSeller);

intInputSellManager()

fpSellManager=FileOpen(SellManagerFile);

fseek(fpSellManager,0,2);

SellManagertemp;

temp,sizeof(SellManager),1,fpSellManager);

FileClose(fpSellManager);

}//数据打印模块

voidprintManager()

Manager*temp;

temp=(Manager*)malloc(sizeof(Manager));

while(fread(temp,sizeof(Manager),1,fpManager)==1)

temp->

ManagerOutput();

voidprintTechnician()

Technician*temp;

temp=(Technician*)malloc(sizeof(Technician));

while(fread(temp,sizeof(Technician),1,fpTechnician)==1)

TechnicianOutput();

voidprintSeller()

Seller*temp;

temp=(Seller*)malloc(sizeof(Seller));

while(fread(temp,sizeof(Seller),1,fpSeller)==1)

SellerOutput();

voidprintSellManager()

SellManager*temp;

temp=(SellManager*)malloc(sizeof(SellManager));

while(fread(temp,sizeof(SellManager),1,fpSellManager)==1)

SellManagerOutput();

}//统计模块

voidSellerStatistic()//按销售员统计

fpSellManager=FileOpen(SellManagerFile);

SellManager*SMtemp;

Seller*Stemp;

SMtemp=(SellManager*)malloc(sizeof(SellManager));

Stemp=(Seller*)malloc(sizeof(Seller));

while(fread(SMtemp,sizeof(SellManager),1,fpSellManager)==1)

{floatsum=0;

SMtemp->

下属销售员的销售情况:

while(fread(Stemp,sizeof(Seller),1,fpSeller)==1)

if(strcmp(SMtemp->

Staff_name,Stemp->

{cout<

姓名:

Stemp->

销售额:

sum=sum+Stemp->

下属销售员的销售总金额为:

sum<

voidSellManagerStatistic()

structRank

charname[10];

floatwages;

}rank[20];

intnum=0;

SellManager*temp;

temp=(SellManager*)malloc(sizeof(SellManager));

while(fread(temp,sizeof(SellManager),1,fpSellManager)==1)

strcpy(rank[num].name,temp->

Staff_name);

rank[num].wages=temp->

num++;

RankRtemp;

for(inti=0;

i<

num-1;

i++)

for(intj=1;

j<

num-i;

j++)

if(rank[j].wages<

rank[j+1].wages)

strcpy(Rtemp.name,rank[j].name);

Rtemp.wages=rank[j].wages;

strcpy(rank[j].name,rank[j+1].name);

rank[j].wages=rank[j+1].wages;

strcpy(rank[j+1].name,Rtemp.name);

rank[j+1].wages=Rtemp.wages;

排序以后为(从大到小):

for(intk=0;

k<

num;

k++)

姓名"

rank[k].name<

工资:

rank[k].wages<

//目录模块

intStatisticMenu()//统计目录

intchoose=0;

while

(1)

1、按销售员统计。

2、按销售经理统计。

0、返回上级目录。

选择服务类型:

switch(choose)

case1:

SellerStatistic();

break;

case2:

SellManagerStatistic();

case0:

return1;

}

intInputMenu()//数据目录

1、录入经理数据。

2、录入技术员数据。

3、录入销售员数据。

4、录入销售经理数据"

请选择服务类型:

InputManager();

InputTechnician();

case3:

InputSeller();

case4:

InputSellManager();

return0;

intPrintMenu()//打印目录

1、显示经理数据。

2、显示技术员数据。

3、显示销售员数据."

4、显示销售经理数据"

0、返回上级目录"

printManager();

printTechnician();

printSeller();

printSellManager();

break

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

当前位置:首页 > 自然科学 > 数学

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

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