charnode.h

来自「字符频度统计」· C头文件 代码 · 共 41 行

H
41
字号
#ifndef CHAR_NODE_STRUCT
#define CHAR_NODE_STRUCT

#include <iostream.h>

struct CharNode
{
	char ch;
	int fre;
	bool operator==(const CharNode & rhs)
	{
		return (ch==rhs.ch);
	}
	bool operator!=(const CharNode & rhs)
	{
		return (ch!=rhs.ch);
	}
	CharNode & operator =(const CharNode & rhs)
	{
		ch=rhs.ch;
		fre=rhs.fre;
		return *this;
	}
	CharNode & operator ++()
	{
		fre++;
		return * this;
	}
	bool operator>(const CharNode & rhs)
	{
		return fre>rhs.fre;
	}
	friend ostream & operator<<(ostream & os,
		const CharNode & node)
	{
		os<<node.ch<<":"<<node.fre;
		return os;
	}
};

#endif

⌨️ 快捷键说明

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