- 2
- 0
- 约1.32万字
- 约 13页
- 2019-05-18 发布于江苏
- 举报
个人收集整理 勿做商业用途
个人收集整理 勿做商业用途
PAGE / NUMPAGES
个人收集整理 勿做商业用途
#include iomanip
#include iostream
#include fstream
#include malloc.h
#include stdlib.h
#include string.h
#define NULL 0
int const N=20;
#define LEN sizeof(struct staff)
using namespace std;
void Menu();
void Pass();
int n=0; //定义一个全局变量统计职工人数
//定义一个职工信息的结构体
struct staff
{
char name[N]; //用来存放姓名
char sex[N]; //用来存放性别
long id; //用来存放编号
float paid[3]; //用来存放工资
int total; //用来存放总工资
struct staff *next;
};
//职工类
class Information
{
public:
Information() ; //构造函数.
~Information() ; //析构函数.
staff *creat(); //建立链表
void output(staff *head); //显示职工信息
int count(staff *head); //定义函数count()统计职工总数
staff *insert(staff*head); //指针函数*insert()用来添加职工信息.
staff *cancel(staff *head,long id); //指针函数*cancel()用来删除职工信息.
staff *find(staff *head,long id); //指针函数*find()用来查找职工信息.
staff *modify(staff *head,long id); //指针函数*modife()用来修改职工的信息.
void save(staff *head); //保存文件信息
staff *Read(); //读取文件信息
private:
staff *p1,*p2,*p3,*head,st;
};
Information::Information()
{cout ******************************************************************************\n;
cout 欢迎您使用职工工资管理系统\n;
cout ******************************************************************************\n\n;
}
//作者的信息和提示
void zuozhe()
{cout按Enter键进入登陆界面!!;
}
Information::~Information()
{ cout ******************************************************************************\n;
cout 谢谢您使用职工工资管理系统\n;
cout ******************************************************************************\n;
}
//建立链表信息
staff *Information::creat(void)
{//定义一个指向struct student的结构体指针函数*creat()用来录入职工信息.
char ch[N];n=0; //用来存放职工姓名
p1=p2=(staff *)malloc(LEN);//调用malloc()函数用来开辟一个新的存储单元
cout 请建立职工信息表,在姓名处键以 # 结束输入!endl;
cout 姓名:;
cinch;
head=NULL; //给指针head赋初值
while (strcmp(ch,#)!=0)
{ //调用字符比较函数strcmp()用来判断是否继续输入
p1=(staff *)malloc(LEN); //调用malloc()函数用来开辟一个新的存储单元
strcpy(p1-name,
原创力文档

文档评论(0)