hashelem.cpp

来自「此代码运行于visual c++ 6.0的环境下」· C++ 代码 · 共 35 行

CPP
35
字号
// HashElem1.cpp: implementation of the CHashElem class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "HashElem.h"
#include <fstream>
using std::endl;

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

//重载文件流<<运算符
fstream & operator <<( fstream & out, CHashElem & elem ){
	out<<endl;
	out<<elem.Key.c_str()<<endl;
	out<<elem.Pos;
	return out;
}

//重载文件流>>运算符
fstream & operator >>( fstream & in, CHashElem & elem ){
	char temp[100];
	in>>temp;
	elem.Key = temp;
	in>>elem.Pos;
	return in;
}

//重载输出运算符
ostream & operator <<( ostream & out, CHashElem & elem ){
	out<<"key:"<<elem.Key<<endl;
	out<<"position:"<<elem.Pos<<endl;
	return out;
}

⌨️ 快捷键说明

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