staff.cpp

来自「对职工的档案进行管理。包括查找 修改」· C++ 代码 · 共 58 行

CPP
58
字号
// Staff.cpp: implementation of the CStaff class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "SEWORK.h"
#include "Staff.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CStaff::CStaff()
{
	m_working=false;
}

CStaff::CStaff(CString data)//已读入的字符串为构造函数
{
	int nLength=data.GetLength();//得到字符串长度
	char *buf=new char[nLength+1];
	int j=0;
	char *buf1=new char[nLength+1];
	strcpy(buf,data);
	char *p=buf;
	for(int i=0;i<(nLength+1);i++)
	{
		if(buf[i]==0x20)//等于空格
		{
			buf[i]=0x00;
			//得到一个空格,将两串分开
			m_staff_name.Format(p);
			for(i++,j=0;i<(nLength+1);i++,j++)
			{
				buf1[j]=buf[i];
			}
			m_staff_num.Format(buf1);
			m_working=false;
			delete buf;
			delete buf1;
			return ;
		}
	}
	delete buf;
	delete buf1;
}

CStaff::~CStaff()
{

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?