資源描述:
《c++課程設計高校水電費管理系統》由會員上傳分享,免費在線閱讀,更多相關內容在行業(yè)資料-天天文庫。
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="創(chuàng)業(yè)辦公室";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<<"請輸入學號:"<