decode.cpp

来自「推荐一个快速压缩算法」· C++ 代码 · 共 43 行

CPP
43
字号
// decode.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include "model.h"


class CDecode
: public CArithmeticModel<CDecode>
{
public:
	int GetByte()
	{
        return getc(stdin);			
	}
	void main()
	{
		start_model();				/* Set up other modules.    */
		start_inputing_bits();
		start_decoding();
		for (;;) {					/* Loop through characters. */
			int ch; int symbol;
			symbol = decode_symbol(cum_freq);	/* Decode next symbol.      */
			if (symbol==EOF_symbol) break;		/* Exit loop if EOF symbol. */
			ch = index_to_char[symbol];		/* Translate to a character.*/
			putc(ch,stdout);			/* Write that character.    */
			update_model(symbol);			/* Update the model.        */
		}
	}
};

int main(int /*argc*/, char* /*argv[]*/)
{
	_setmode( _fileno( stdin ), _O_BINARY );
	_setmode( _fileno( stdout ), _O_BINARY );

	CDecode model;
	model.main();

	return 0;
}

⌨️ 快捷键说明

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