资源简介
用rose画出了 人事管理中常用的用例图,类图,顺序图,协作图.虽然简单但是思路还是很清晰的,软件的开发设计重要的就是思想.
代码片段和文件信息
#include
#include
#include
#include “emp1.h“
#include “comm.h“
struct emp_struct
{
int number;
char name[30];
int gcode;
int scode;
}estruct; //员工信息记录结构,用于记录员工信息
struct sal_struct
{
int number;
char name[30];
int month;
float salary;
}sstruct; //员工工资信息记录结构,用于记录工资信息
//**********************************************
//class Employee
//**********************************************
void Employee::addEmployee( )
{
cout << endl << “请输入员工姓名:“;
cin >> name;
cout << “请输入员工编号(1000-9999):“;
cin >> number;
while(number<1000 || number>9999)
{
cout << endl << “员工编号应为4位整数,请重新输入:“;
cin >> number;
}
cout << “请输入员工所在柜组的代码(1 食品 2 服装 3 电器):“;
cin >> group_code; //获取员工柜组代码
while(group_code!=‘1‘ && group_code!=‘2‘ && group_code!=‘3‘)
{
cin >> group_code;
}
group_code-=48; //将柜组代码由字符转换为数字
cout << endl << “请输入员工的职务代码(1 售货员 2 经理 3库管):“;
cin >> status_code; //获取员工职务代码
while(status_code!=‘1‘&& status_code!=‘2‘&& status_code!=‘3‘)
{
cin >> status_code;
}
status_code-=48; //将职务代码由字符转换为数字
strcpy(estruct.namename); //将信息写入结构体estruct中
estruct.number=number;
estruct.gcode=group_code;
estruct.scode=status_code;
ofstream ofile(“Employee.txt“ios::app|ios::binary);
if(!ofile)
{
cerr << endl << “员工信息文件打开错误!“ << endl;
return;
}
ofile.write((char*)&estructsizeof(estruct));
ofile.close( );
cout << “增加完毕“ << endl;
}
void Employee::delEmployee( ) //删除员工信息
{
int i;
long inpos; //用于记录文件指针位置
cout << endl << “请输入待删除员工姓名:“;
cin >> name;
fstream iofile(“employee.txt“ ios::in|ios::out|ios::binary);
if(!iofile)
{
cerr << endl << “员工信息文件读取错误“ << endl;
return;
}
while(!iofile.eof( )) //读到文件结束
{
inpos=iofile.tellg( ); //获取当前文件指针位置
iofile.read((char*)&estructsizeof(estruct));
i=strcmp(estruct.namename);
if(i==0)
{
estruct.number=0;
strcpy(estruct.name“# # #“);
estruct.gcode=0;
estruct.scode=0;
iofile.seekp(inpos);
iofile.write((char*)&estructsizeof(estruct));
cout << endl << “删除成功“;
break;
}
}
iofile.close( );
if(i!=0)
{
cout << “未发现待删除员工记录!“;
}
}
void Employee::satusChange(char name_str[30]int g_codeint s_code)
{
int i;
long inpos; //用于记录文件指针位置
fstream iofile(“Employee.txt“ ios::in|ios::out|ios::binary);
if(!iofile)
{
cerr << endl << “员工信息文件读取错误“ << endl;
return;
}
while(!iofile.eof( )) //读到文件结束
{
inpos=iofile.tellg( ); //获取当前文件指针位置
iofile.read((char*)&estructsizeof(estruct));
i=strcmp(estruct.namename_str);
if(i==0)
{
estruct.gcode=g_code; //柜组代码
estruct.scode=s_code; //职务代码
iofile.seekp(inpos); //将文件指针从待修改记录的尾部移动到头部
iofile.write((char*)&estructsizeof(estruct));
cout << endl << “员工职务更改成功“;
break;
}
}
iofile.close( );
if(i!=0)
{
cout << “未发现待修改员工记录!“;
}
}
//*********************************************************************
//************
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1566 2007-07-23 13:55 emp\emp1.h
文件 8351 2007-07-23 13:53 emp\Employee.cpp
文件 3791 2010-06-25 15:28 emp\main.cpp
文件 3626 2007-07-23 11:20 emp\main.dsp
文件 533 2007-07-23 11:12 emp\main.dsw
文件 1608192 2010-06-25 12:28 UML大作业.doc
目录 0 2010-06-25 15:29 emp
----------- --------- ---------- ----- ----
1626059 7
- 上一篇:游标与返回结果集的存储过程
- 下一篇:多目标整数编码的遗传算法求解集装箱船配载问题
相关资源
- 数据库课程设计停车场管理系统
- UML建模大全
- FTP课程设计(服务端+客户端)
- 高频电子线路课程设计报告收音机
- 直流稳压电源的课程设计、安装及调
- EDA课程设计_密码锁
- 单片机课程设计 篮球计分器
- 数据结构课程设计 6 1 彩票系统
- 端口扫描课程设计详细的报告
- 步进电机课程设计(个人设计)
- 校园网络规划与设计课程设计
- 编译原理课程设计:词法语法编译器
- 4 1视图建模教程实例大全
-
simuli
nk 课程设计 qpsk - 武汉理工大学 单片机课程设计 16*16点
- 数据库VFP课程设计
- 分页系统模拟实验 操作系统 课程设
- 模拟段页式虚拟存储管理中地址转换
- 硬件课程设计—流水灯(quartus软件
- 超市收银系统eclipse access大学课程设计
- 航空订票系统_数据结构课程设计
- c 课程设计 职工信息管理系统
- 汇编语言,课程设计,红绿灯
- 机床液压系统课程设计卧式钻床动力
- 课程设计蔬菜大棚自动控制系统,包
- 密码学课程设计:DES加密解密算法的
- 操作系统课程设计完整版
- 磁盘调度算法的模拟实现及对比
- PL/0功能扩充break功能
- 数据库课程设计以及指导思想
评论
共有 条评论