etline(tea.name,30,'\n');//使其能够读入字符串中的空格is>>tea.sex;is>>tea.major_or_department;is>>tea.date;is>>tea.age;is>>tea.job; is>>tea.salary; returnis;//退出函数?}friendostream&operator<<(ostream&os,teacher&tea)//重载"<<"运算符函数声明{os<<tea.num<<'\n'; os<<tea.name<<'\n'; os<<tea.sex<<'\n'; os<<tea.major_or_department<<'\n'; os<<tea.date<<'\n'; os<<tea.age<<'\n'; os<<tea.job<<'\n'; os<<tea.salary<<'\n'; returnos;//退出函数}voidAddData()?{system("cls"); cout<<"请输入教工号:"; cin>>num; for(intk=1;k<11;k++) if(num==k) k=11; if(k==11) { cout<<"请输入10以内的教工号"<<endl; AddData(); } cout<<"请输入教师姓名:"; cin>>name; cout<<"请输入教师性别:"; cin>>sex; cout<<"请输入教师工作系别部门:"; cin>>major_or_department; cout<<"请输入教师出生时间:"; cin>>date; cout<<"请输入教师年龄:"; cin>>age; cout<<"请输入教师职称(如教授/副教授/讲师):"; cin>>job; cout<<"请输入教师工资:"; cin>>salary;?try//处理教师工资合法性