-
大小: 536KB文件類(lèi)型: .rar金幣: 1下載: 0 次發(fā)布日期: 2021-06-19
- 語(yǔ)言: 其他
- 標(biāo)簽: UML??課程設(shè)計(jì)??人事管理??
資源簡(jiǎn)介
用rose畫(huà)出了 人事管理中常用的用例圖,類(lèi)圖,順序圖,協(xié)作圖.雖然簡(jiǎn)單但是思路還是很清晰的,軟件的開(kāi)發(fā)設(shè)計(jì)重要的就是思想.
代碼片段和文件信息
#include?
#include?
#include?
#include?“emp1.h“
#include?“comm.h“
struct?emp_struct
{
int?number;
char?name[30];
int?gcode;
int?scode;
}estruct;? //員工信息記錄結(jié)構(gòu),用于記錄員工信息
struct?sal_struct
{
int?number;
char?name[30];
int?month;
float?salary;
}sstruct;? //員工工資信息記錄結(jié)構(gòu),用于記錄工資信息
//**********************************************
//class?Employee
//**********************************************
void?Employee::addEmployee(?)
{
cout?< cin?>>?name;
cout?<“請(qǐng)輸入員工編號(hào)(1000-9999):“;
cin?>>?number;
while(number<1000?||?number>9999)
{
cout?< cin?>>?number;
}
cout?<“請(qǐng)輸入員工所在柜組的代碼(1?食品?2?服裝?3?電器):“;
cin?>>?group_code;? //獲取員工柜組代碼
while(group_code!=‘1‘?&&?group_code!=‘2‘?&&?group_code!=‘3‘)
{
cin?>>?group_code;
}
group_code-=48;? //將柜組代碼由字符轉(zhuǎn)換為數(shù)字
cout?< cin?>>?status_code;?//獲取員工職務(wù)代碼
while(status_code!=‘1‘&&?status_code!=‘2‘&&?status_code!=‘3‘)
{
cin?>>?status_code;
}
status_code-=48;? //將職務(wù)代碼由字符轉(zhuǎn)換為數(shù)字
strcpy(estruct.namename);? //將信息寫(xiě)入結(jié)構(gòu)體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(?))? //讀到文件結(jié)束
{
inpos=iofile.tellg(?);? //獲取當(dāng)前文件指針位置
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?<“未發(fā)現(xiàn)待刪除員工記錄!“;
}
}
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(?))? //讀到文件結(jié)束
{
inpos=iofile.tellg(?);? //獲取當(dāng)前文件指針位置
iofile.read((char*)&estructsizeof(estruct));
i=strcmp(estruct.namename_str);
if(i==0)
{
estruct.gcode=g_code;? //柜組代碼
estruct.scode=s_code;? //職務(wù)代碼
iofile.seekp(inpos);? //將文件指針從待修改記錄的尾部移動(dòng)到頭部
iofile.write((char*)&estructsizeof(estruct));
cout?< break;
}
}
iofile.close(?);
if(i!=0)
{
cout?<“未發(fā)現(xiàn)待修改員工記錄!“;
}
}
//*********************************************************************
//************
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件???????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大作業(yè).doc
?????目錄??????????0??2010-06-25?15:29??emp
-----------?---------??----------?-----??----
??????????????1626059????????????????????7
評(píng)論
共有 條評(píng)論