sale.h
来自「利用虚函数定义工人信息」· C头文件 代码 · 共 28 行
H
28 行
class salesman:virtual public employee{
protected:
float commrate;
float sales;
public:
salesman(){commrate=0.04;}
void input(){cout<<"销售员";employee::input();}
void save(){
fstream outfile;
outfile.open("F:shuju.txt",ios::app);
if(!outfile){
cout<<"f can't open.\n";
abort();
}
outfile<<"技 术 工"<<endl;
outfile<<"号 码"<<no<<"名 字"<<name<<"性 别"<<sex<<"年 龄"<<age<<"工 资"<<salary<<endl;
}
void pay(){
cout<<name<<"本月销售额:";
cin>>sales;
salary=sales*commrate;
}
void print(){
cout<<"├—————┼—————┼—————┼—————┼—————┤"<<endl;
cout<<"│"<<setw(10)<<no<<"│"<<setw(10)<<name<<"│"<<setw(10)\
<<sex<<"│"<<setw(10)<<age<<"│"<<setw(10)<<salary<<"│"<<endl;
}
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?