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

📄 e2104.cpp

📁 游戏开发数据结构Data Structures for Game Programmers
💻 CPP
字号:
// =======================================================
//  Chapter 21, Example 4
//  Huffman Decompression
// =======================================================
#include <stdlib.h>
#include <stdio.h>
#include <iostream.h>
#include <string.h>
#include "Array.h"
#include "Huffman.h"



void main()
{
    typedef unsigned char uchar;
    Array<uchar> uncompressed( 1 );
    Huffman<uchar, 255> compressed;

    // filename
    char dataname[80];
    char treename[80];

    // get the file names
    cout << "Enter tree file name: ";
    cin >> treename;
    cout << "Enter data file name: ";
    cin >> dataname;


    // load the tree
    compressed.LoadTree( treename );

    // load the data
    compressed.LoadData( dataname );

    // decompress the data
    compressed.Decompress( uncompressed );


    // chop off the ending of the file name
    dataname[ strlen(dataname) - 5 ] = 0;
    uncompressed.WriteFile( dataname );

    cout << "Decompressed to " << dataname << endl;
}

⌨️ 快捷键说明

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