studentinfo.cpp

来自「我们C++课上」· C++ 代码 · 共 28 行

CPP
28
字号
#include "stdafx.h"
#include "StudentInfo.h"

CStudentInfo::CStudentInfo(CString name, CString id, BOOL male, CTime birth, CString special)
{
	strName		= name;
	strNO		= id;
	bMale		= male;
	tBirth		= birth;
	strSpecial	= special;
}
void CStudentInfo::Display(int y, CDC *pDC)
{
	CString str, strSex("女");
	if (bMale) strSex = "男";
	str.Format("%s  %s  %s  %s  %s", strName, strNO,
		strSex, tBirth.Format("%Y-%m-%d"), strSpecial);
	pDC->TextOut(0, y, str);
}
IMPLEMENT_SERIAL(CStudentInfo, CObject, 1)	// 序列化实现
void CStudentInfo::Serialize(CArchive &ar)
{
	if (ar.IsStoring())
		ar<<strName<<strNO<<bMale<<tBirth<<strSpecial;
	else
		ar>>strName>>strNO>>bMale>>tBirth>>strSpecial;
}

⌨️ 快捷键说明

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