- #include <fstream>
- #include <string>
- #include "Dictionary.h"
- int main(int argc, char* argv[])
- {
- std::ifstream file("test2.lzw");
- std::ofstream out("test2.txt");
- std::string prefix = "";
- char ch;
- long mask;
- Dictionary dict;
- while (!file.eof())
- {
- file>>mask>>ch;
- std::string temp = dict.get_perfix(mask)+ch;
- out<<temp;
- dict.add(temp);
- }
- std::cout<<"decompress success"<<std::endl;
- return 0;
- }
解压算法
最新推荐文章于 2025-07-12 13:54:16 发布
本文介绍了一种基于LZW算法的文件解压缩实现方法。通过读取特定格式的压缩文件,利用字典数据结构逐步还原原始数据,并将解压后的文本输出到新文件中。该程序使用C++编写,涉及文件输入输出操作、字符处理及字典维护等功能。
1203

被折叠的 条评论
为什么被折叠?



