📄 teacher.cpp
字号:
#include<fstream.h>
#include"stdlib.h"
#include"teacher.h"
#include"string.h"
#include"iostream.h"
struct people_str
{
int ID;
char name[8];
char kind[20];
double salary;
}testruct[30];
teacher::teacher(){}
teacher::~teacher(){}
int teacher::s=0;
void teacher::addpeople()
{
cout<<"\n编号:"; cin>>testruct[s].ID;
cout<<"姓名:"; cin>>testruct[s].name;
cout<<"上学期工作量:"; cin>>b;
testruct[s].salary=800+(b-120)*20;
cout<<"职位:教师"<<endl;
cout<<"\n月工资:"<<testruct[s].salary;
ofstream outfile("worker.txt",ios::in|ios::out,0);
if(! outfile)
{
cerr<<endl<<"员工信息文件打开错误!"<<endl;
abort();
}
outfile.seekp(0,ios::end);
outfile<<testruct[s].ID<<" "<<testruct[s].name<<" "
<<testruct[s].salary<<" "<<"教师"<<testruct[s].kind<<endl;
outfile.close();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -