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