tec.h

来自「利用虚函数定义工人信息」· C头文件 代码 · 共 28 行

H
28
字号
class technician:virtual public employee{
private:
	float hourlyrate;
	int workhours;
public:
	technician(){hourlyrate=100;}
	void pay(){
		cout<<name<<"本月工作时数:";
		cin>>workhours;
		salary=hourlyrate*workhours;
	}
	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 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 + -
显示快捷键?