c程序设计实习报告Word文档下载推荐.docx
《c程序设计实习报告Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《c程序设计实习报告Word文档下载推荐.docx(30页珍藏版)》请在冰点文库上搜索。
![c程序设计实习报告Word文档下载推荐.docx](https://file1.bingdoc.com/fileroot1/2023-5/1/20c97d64-67f1-4331-8270-66c168ad883e/20c97d64-67f1-4331-8270-66c168ad883e1.gif)
1数据录入:
输入各种数据;
2数据统计:
统计各销售经理下属销售员的销售额之和;
销售经理按工资进行的冒泡排序;
3数据打印:
打印各类员工的数据信息;
4数据备份:
把各类员工的数据信息写入文件中保存;
5退出:
推出本系统;
(5)菜单说明
⑴数据录入指通过键盘输入各类员工的各项数据;
⑵数据统计指统计各销售经理下身书销售员的销售额及销售额之和;
销售按工资进行冒泡排序;
⑶数据打印指按照表格的格式在屏幕上输出各员工的信息;
⑷数据备份指将所有员工的信息保存到文件;
⑸退出:
结束程序的运行。
二、设计思路
从运行效果上看,可以知道该程序有五个功能,这五个功能要在主函数中利用switch语句选择实现。
该程序中,有主要的四类人员,都继承于雇员这个基类。
在每一类成员中都有自己相应得受保护的数据成员,并且有为实现各种功能的函数。
整个程序是根据要求的功能通过分块编写完成,最后通过主函数中的的switch语句的调用每个功能的函数来进行组装。
三程序清单:
#include<
iostream>
#include<
fstream>
process.h>
string>
iomanip>
usingnamespacestd;
ofstreammyfile;
voidshuru();
voidfun();
voidprint();
voidtuichu();
voidtj();
voidfun4();
constn=2;
constp=4;
//销售人员数
voidtongji();
classEmployer//雇员类
{
protected:
stringjname;
charjsex;
intjage;
public:
voidinput()
{
cout<
<
"
请输入姓名:
;
cin>
>
jname;
请输入性别(m/w):
jsex;
请输入年龄:
jage;
}
};
classJingli:
publicEmployer//经理类
{protected:
intjlxh;
stringname;
charsex;
intage,salary;
Jingli()
salary=8000;
}
name;
请输入性别:
sex;
age;
voidget()
cout<
输入经理编号:
cin>
jlxh;
intdate1()
returnjlxh;
stringdate2()
returnname;
chardate3()
returnsex;
intdate4()
returnage;
intincome()
returnsalary;
voidbeifen()
myfile<
┃"
setw(12)<
jlxh<
name<
sex<
age<
salary<
endl;
Jinglijl[n];
classJishu:
publicEmployer//技术员
intjsxh,time;
intage;
voidget1()
输入技术员编号:
jsxh;
voidget2()
输入工作时间:
time;
voidinput()
returntime*100;
returnjsxh;
jsxh<
income()<
Jishujs[n];
classXiaoshou:
publicEmployer//销售员类
intxsxh,suoshu,xse;
输入销售员编号:
xsxh;
输入销售额:
xse;
voidget3()
输入所属销售经理编号:
suoshu;
returnxsxh;
intdate3()
returnxse;
returnsuoshu;
chardate5()
intdate6()
returnxse*0.04;
voidbeifen()
xsxh<
Xiaoshouxs[p];
classXsjingli:
publicEmployer//销售经理类
inti,add;
Xsjingli()
base=5000;
{cout<
输入销售经理编号:
xsjlxh;
returnxsjlxh;
chardate3()
intad()
add=0;
for(i=0;
i<
p;
i++)
if(xsjlxh==xs[i].date4())
{
add=xs[i].date3()+add;
}
salary=add*0.005+base;
returnadd;
intincome()
voiddisplay()
xsjlxh<
intxsjlxh;
intage,base,salary;
Xsjinglixsjl[n];
intmain()//主函数
{inta;
do
{fun();
a;
switch(a)
{case1:
shuru();
break;
case2:
tj();
case3:
print();
case4:
fun4();
case5:
tuichu();
}
}while(a<
5);
return0;
voidshuru()//数据输入
{inti,j,k,l;
for(k=0;
k<
n;
k++)
{js[k].get1();
js[k].input();
js[k].get2();
cout<
----------------------------------------"
for(l=0;
l<
l++)
{
jl[l].get();
jl[l].input();
for(j=0;
j<
j++)
xs[j].get1();
xs[j].input();
xs[j].get2();
xs[j].get3();
for(i=0;
{
xsjl[i].get();
xsjl[i].input();
voidprint()//打印
inti;
请等待........"
技术员"
┏━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━┓"
职工号"
姓名"
性别"
年龄"
工资"
for(i=0;
┣━━━━━━╋━━━━━━╋━━━━━━╋━━━━━━╋━━━━━━┫"
js[i].date1()<
js[i].date2()<
js[i].date3()<
js[i].date4()<
js[i].income()<
┗━━━━━━┻━━━━━━┻━━━━━━┻━━━━━━┻━━━━━━┛"
-------------------------------------------------------------------------------"
经理"
jl[i].date1()<
jl[i].date2()<
jl[i].date3()<
jl[i].date4()<
jl[i].income()<
销售经理"
cout<
xsjl[i].date1()<
xsjl[i].date2()<
xsjl[i].date3()<
xsjl[i].date4()<
xsjl[i].income()<
销售员"
┎━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━━━━━┓"
setw(8)<
setw(16)<
所属部门经理编号"
┣━━━━╋━━━━╋━━━━╋━━━━╋━━━━╋━━━━━━━━┫"
xs[i].date1()<
xs[i].date2()<
xs[i].date5()<
xs[i].date6()<
xs[i].income()<
xs[i].date4()<
┗━━━━┻━━━━┻━━━━┻━━━━┻━━━━┻━━━━━━━━┛"
voidfun4()
myfile.open("
d:
\\程序设计实习\\备份.txt"
ios:
:
out);
inti;
请等待.........."
myfile<
职工基本情况一览表如下"
技术员:
myfile<
for(i=0;
{
js[i].beifen();
经理:
endl<
jl[i].beifen();
销售经理:
xsjl[i].beifen();
xs[i].date2