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

📄 huf.cpp

📁 运用面向对象方法编写的一个haffman编码树
💻 CPP
字号:
// Huf.cpp: implementation of the Huf class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Huf.h"
#include "iostream.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Huf::Huf()
{
	numofwords=0;
	numofcodes=0;
	for(int i=0;i<128;i++)
	{
		frelist[i]=0;
		weight[i]=0;
	}
}

Huf::~Huf()
{

}

void Huf::getlist()
{
	char temp='a';
	
	while(temp!='0')
	{
		cin>>temp;
		words[numofwords++]=temp;
		if(temp!='0')
		{
			frelist[(int)temp]++;
		}//获取频率
	}
	words[numofwords+1]='\0';
}

⌨️ 快捷键说明

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