资源描述:
《c++课程设计高校水电费管理系统》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include#include#include#includeconstintTMAX=50;usingnamespacestd;classPerson{public:intnum;//编号stringname;//姓名stringsex;//性别intage;//年龄doublewater;//用水量doublepower;//用电量public:Person(intn=0,stringnm="",strings="",inta=0,do
2、ublew=0.0,doublep=0.0)//初始化{num=n;name=nm;sex=s;age=a;water=w;power=p;};virtualvoidInput(){};virtualvoidOutput(){};intGetNum(){returnnum;}//获取编号stringGetName(){returnname;}//获取姓名doubleGetWater(){returnwater;}//获取用水量doubleGetPower(){returnpower;}//获取用电量};class
3、Teacher:virtualpublicPerson//教师{public:stringdepart;//工作部门doublewatermoney;//教师水费doublepowermoney;//教师电费intchoice1;intchoice2;public:Teacher(intn=0,stringnm="",strings="男",inta=0,stringd="普通教师",doublew=0.0,doublep=0.0,doublewm=0.0,doublepm=0.0):Person(n,nm,s,
4、a,w,p),depart(d)//构造函数{watermoney=wm;powermoney=pm;};voidInput(){cout<<"请输入编号:"<>num;cout<<"请输入姓名:"<>name;cout<<"请选择性别:";cout<<"(1.男2.女)"<>choice2;switch(choice2){case1:sex="男";break;case2:sex="女";break;defa
5、ult:cout<<"输入错误。"<>age;cout<<"请选择工作部门:"<>choice1;switch(choice1){case1:depart="普通教师";break;case2:de
6、part="教务处";break;case3:depart="财政处";break;case4:depart="创业办公室";break;default:cout<<"输入错误。"<>water;cout<<"请输入本月的用电量"<>power;watermoney=0.5*water;powermoney=0.5*power;}voidOutput(){cout<<""<7、sex<<""<8、stringnm="",strings="男",inta=0,stringz="",doublew=0.0,doublep=0.0,doublewm=0.0,doublepm=0.0):Person(n,nm,s,a,w,p),bj(z)//构造函数{watermoney=wm;powermoney=pm;};voidInput(){cout<<"请输入学号:"<