model.h

来自「有关几个数字编码的C++ 程序」· C头文件 代码 · 共 41 行

H
41
字号
// Model.h: interface for the CModel class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MODEL_H__FEA8F0E8_75C2_4404_A9A0_10F6F0B1701E__INCLUDED_)
#define AFX_MODEL_H__FEA8F0E8_75C2_4404_A9A0_10F6F0B1701E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// the set of symbols that may be encoded
#define nof_chars 256			// number of character symbols
#define EOF_symbol (nof_chars+1)	// index of EOF symbol
#define nof_symbols (nof_chars+1)	// total number of symbols

// max frequency count
#define max_frequency 16383

class CModel
{
public:
    int freq[nof_symbols+1];

    // translation tables between characters and symbol indexes
    int char_to_index[nof_chars];
    unsigned char index_to_char[nof_chars+1];

    // cummulative frequency table
    int cum_freq[nof_symbols+1];

public: 
    CModel();
    ~CModel();
    void start();
    void update(int symbol);

};

#endif // !defined(AFX_MODEL_H__FEA8F0E8_75C2_4404_A9A0_10F6F0B1701E__INCLUDED_)

⌨️ 快捷键说明

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