xingzheng.cpp
来自「高校工资管理系统 Visual C++实现简单的高校工资管理系统」· C++ 代码 · 共 33 行
CPP
33 行
#include<fstream.h>
#include"stdlib.h"
#include"xingzheng.h"
#include"string.h"
#include"iostream.h"
struct people_str
{
int ID;
char name[8];
char kind[20];
double salary;
}xzstruct[30];
xingzheng::xingzheng(){}
xingzheng::~xingzheng(){}
int xingzheng::l=0;
void xingzheng::addpeople()
{
cout<<"\n编号:"; cin>>xzstruct[l].ID;
cout<<"姓名:"; cin>>xzstruct[l].name;
xzstruct[l].salary=1000;
cout<<"职位:行政人员";
cout<<"\n月工资:"<<xzstruct[l].salary;
ofstream outfile("worker.txt",ios::in|ios::out,0);
if(! outfile)
{
cerr<<endl<<"员工信息文件打开错误!"<<endl;
abort();
}
outfile.seekp(0,ios::end);
outfile<<xzstruct[l].ID<<" "<<xzstruct[l].name<<" "
<<xzstruct[l].salary<<" "<<"行政人员"<<xzstruct[l].kind<<endl;
outfile.close();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?