資源簡介
用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?< cin?>>?name;
cout?<“請輸入員工編號(1000-9999):“;
cin?>>?number;
while(number<1000?||?number>9999)
{
cout?< 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?< 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?< return;
}
ofile.write((char*)&estructsizeof(estruct));
ofile.close(?);
cout?<“增加完畢“?<}
void?Employee::delEmployee(?)? //刪除員工信息
{
int?i;
long?inpos;? //用于記錄文件指針位置
cout?< cin?>>?name;
fstream?iofile(“employee.txt“?ios::in|ios::out|ios::binary);
if(!iofile)
{
cerr?< 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?< 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?< 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?< 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
- 上一篇:游標與返回結果集的存儲過程
- 下一篇:多目標整數編碼的遺傳算法求解集裝箱船配載問題
評論
共有 條評論