⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 haffman.h

📁 本程序使用C++编写
💻 H
字号:
// HaffmanCode.h: interface for the CHaffmanCode class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_HAFFMANCODE_H__97047FC5_4CFC_4C38_8B7A_C3247AC1478A__INCLUDED_)
#define AFX_HAFFMANCODE_H__97047FC5_4CFC_4C38_8B7A_C3247AC1478A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define iMax 1024
#define iMaxValue 2147483648
#define iBits 256
#include <iostream>
#include <fstream>
using namespace std;

struct rect
{
	int lenth;
	int wide;
};
struct HaffNode
{
	unsigned int iWeight;	  
	int iLeftChild;
	int iRightChild;
	int iParent;
	int iFlag;
	HaffNode()
	{iWeight = 0;iLeftChild = -1; iRightChild = -1; iParent = -1; iFlag = 0; }
};

struct Code //用于存每个叶子节点的编码
{
	int iStart;//编码在数组中的开始端 - 1
	char Bit[255];//每个都设置为255个字符

};

class CHaffmanCode
{
	//friend float OpenandCloseFile(CString OpenFile,CString &CloseFile);//打开文件,调用函数进行编码压缩
	//friend float ChangtoCode(CString OpenFile,CString &CloseFile);//使用已有的编码,对文件压缩
	//friend void TranslateCodes(CString OpenFile,CString &CloseFile);//译码,解压缩
public:
	HaffNode *hArray ; 
	Code *codes;
public:
	void CreateHaffmanTree(HaffNode *p);//建立哈夫曼树 
	void EnHaffmanCode(HaffNode *p,Code *cd);//对哈夫曼树的每个节点编码
	CHaffmanCode();
	virtual ~CHaffmanCode();
};

#endif // !defined(AFX_HAFFMANCODE_H__97047FC5_4CFC_4C38_8B7A_C3247AC1478A__INCLUDED_)

⌨️ 快捷键说明

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