⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tec.h

📁 利用虚函数定义工人信息
💻 H
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -