为了账号安全,请及时绑定邮箱和手机立即绑定

c++程序出错,找不到原因,(运行统计功能是出错)

c++程序出错,找不到原因,(运行统计功能是出错)

C++
用户1220331 2015-12-17 09:44:20
#include <iostream>#include <fstream>using namespace std;class people{public: int number; double money; char work[30];    char name[30]; virtual void Show() { cout<<"工号:"<<number<<"  "<<"姓名:"<<name<<"  "<<"基本工资:"<<money<<"  "<<"岗位类型:"<<work<<"  "<<endl;; } virtual void Book() { cout<<"工号:";   cin>>number; cout<<"姓名:";   cin>>name;        cout<<"基本工资:";   cin>>money; cout<<"岗位类型:";   cin>>work; } virtual void Save(fstream &f) //保存到文件f中 { f<<number<<" "<<name<<" "<<money<<" "<<work<<" "; } virtual void Load(fstream &f) //从文件f中导出数据 { f>>number>>name>>money>>work; }};class js:virtual public people//教师类{public:  double cMoney; double gzl; void Show() { cout<<"教师:"<<endl; cout<<"工号:"<<number<<"  "<<"姓名:"<<name<<"  "<<"基本工资:"<<money<<"  "<<"实际工资:"<<countMoney()<<"  "<<"岗位类型:"<<work<<"  "<<"工作量:"<<gzl<<endl; } double countMoney()    //结算工资 { if(gzl<100) { cMoney=money+gzl*20*0.8; } else { cMoney=money+(gzl-100)*20+100*25; } return cMoney; } void Book(int n) { cout<<"\n请输入教师的信息:"<<endl; people::Book(); cout<<"教师的工作量为:";   cin>>gzl;        cout<<"教师的工资为:"<<countMoney()<<endl;    //调用工资函数 } virtual void Save(fstream &f) //保存到文件f中 { people::Save(f); f<<cMoney<<gzl<<endl; } virtual void Load(fstream &f) //从文件f中导出数据 { people::Load(f); f>>cMoney>>gzl; }};class syy:virtual public people//实验员类{public: double cMoney; double  sybt; void Show() { cout<<"实验员:"<<endl; cout<<"工号:"<<number<<"  "<<"姓名:"<<name<<"  "<<"基本工资:"<<money<<"  "<<"实际工资:"<<countMoney()<<"  "<<"岗位类型:"<<work<<"  "<<endl;; } double countMoney() { cMoney=money+sybt; return cMoney; } void Book(int n) { cout<<"\n请输入实验员的信息:"<<endl; people::Book(); cout<<"实验员的实验补贴为:";    cin>>sybt;        cout<<"实验员的工资为:"<< countMoney()<<endl;     } virtual void Save(fstream &f) //保存到文件f中 { people::Save(f); f<<cMoney<<endl; }    virtual void Load(fstream &f) //从文件f中导出数据 { people::Load(f); f>>cMoney; }};class xzry:virtual public people//行政人员类{public: double cMoney; double xzbt; void Show() { cout<<"行政人员:"<<endl; cout<<"工号:"<<number<<"  "<<"姓名:"<<name<<"  "<<"基本工资:"<<money<<"  "<<"实际工资:"<<countMoney()<<"  "<<"岗位类型:"<<work<<"  "<<"行政补贴:"<<xzbt<<endl;; } double countMoney() { cMoney=money+xzbt; return cMoney; } void Book(int n) { cout<<"\n请输入行政人员的信息:"<<endl; people::Book();  cout<<"行政人员的行政补贴为:";   cin>>xzbt;        cout<<"行政人员的工资为:"<< countMoney()<<endl;      } virtual void Save(fstream &f) //保存到文件f中 { people::Save(f); f<<cMoney<<xzbt<<endl; } virtual void Load(fstream &f) //从文件f中导出数据 { people::Load(f); f>>cMoney>>xzbt; }};class js_syy: virtual public js,virtual public syy//教师兼职实验员类{public: double cMoney; double sybt; double gzl; void Show() { cout<<"教师兼职实验员:"<<endl; cout<<"工号:"<<number<<"  "<<"姓名:"<<name<<"  "<<"基本工资:"<<money<<"  "<<"实际工资:"<<countMoney()<<"  "<<"岗位类型:"<<work<<"  "<<"工作量:"<<gzl<<" "<<"实验补贴:"<<sybt<<endl;; } double countMoney()     { if(gzl<70) { cMoney=sybt+money+gzl*20*0.8; } else { cMoney=sybt+money+(gzl-70)*20+100*25; } return cMoney; } void Book(int n) { cout<<"\n请输入教师兼职实验员的信息:"<<endl; people::Book(); cout<<"教师兼职实验员的工作量为:";  cin>>gzl; cout<<"教师兼职实验员的实验补贴为:";   cin>>sybt;        cout<<"教室兼职实验员的工资为:"<<countMoney()<<endl; }    virtual void Save(fstream &f) //保存到文件f中 { people::Save(f); f<<cMoney<<gzl<<sybt<<endl; }    virtual void Load(fstream &f) //从文件f中导出数据 { people::Load(f); f>>cMoney>>gzl>>sybt; }};
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 1527 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信