huf.cpp
来自「运用面向对象方法编写的一个haffman编码树」· C++ 代码 · 共 43 行
CPP
43 行
// 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 + =
减小字号Ctrl + -
显示快捷键?