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