资源简介
题目:利用哈夫曼编码进行对已有文件进行重新编码可以大大提高减小文件大小,减少存储空间。但是,这要求在首先对一个现有文件进行编码行成新的文件,也就是压缩。在文件使用时,再对压缩文件进行解压缩,也就是译码,复原原有文件。试为完成此功能,写一个压缩/解压缩软件(控制台程序,不要求界面)。
详细讲解请参考文章:https://blog.csdn.net/weixin_44387644/article/details/105906221
代码片段和文件信息
// Compress(Decompress) Software.cpp : 定义控制台应用程序的入口点。
//
#include “stdafx.h“
#include
#include “HuffmanTree.h“
using namespace std;
void main()
{
int nChoice = 1;
char pcInput[255] pcOutput[255];
HuffmanTree h;
while (nChoice)
{
cout << “【Compression and Decompression of Files——Szip】“ << endl;
cout << “Please enter characters to select functions:“ << endl;
cout << “* 1:Compression“ << endl;
cout << “* 2:Decompression“ << endl;
cout << “* 3:Comparing the original file with the decompressed file“ << endl;
cout << “——————————————————————————“< cin >> nChoice;
switch (nChoice)
{
case 1:
{
cout << “Please enter the absolute path of the file to be compressed:“;
cin >> pcInput;
cout << “Please enter the compressed file absolute path: “;
cin >> pcOutput;
if (h.doCompress(pcInput pcOutput))
{
h.compareCompressFile(pcInput pcOutput);
cout << endl << “Successful file compression!“ << endl;
}
else
{
cout << endl << “File compression failed! “ << endl;
}
}
break;
case 2:
{
cout << “Please enter the unzipped file name: “;
cin >> pcInput;
cout << “Please enter the unzipped file name: “;
cin >> pcOutput;
if (h.doDecompress(pcInput pcOutput))
{
cout << endl << “The file was decompressed successfully! “ << endl;
//h.compareDecompressFile(input output);
}
else
cout << endl << “File decompression failed! “ << endl;
}
break;
case 3:
{
cout << “Please enter the file name of the original file:“;
cin >> pcInput;
cout << “Please enter the unzipped file name:“;
cin >> pcOutput;
h.compareDecompressFile(pcInput pcOutput);
}
break;
default:
cout << “Please input the instructions correctly!“ << endl;
break;
}
cout << endl;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-12-19 21:01 Compress(Decompress) Software\
文件 11219 2019-01-11 09:02 Compress(Decompress) Software\1.txt
文件 0 2019-12-19 21:01 Compress(Decompress) Software\2.txt
文件 3 2019-12-19 21:01 Compress(Decompress) Software\3.txt
文件 42 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software.opensdf
文件 8650752 2019-12-19 21:02 Compress(Decompress) Software\Compress(Decompress) Software.sdf
文件 1033 2019-01-10 09:43 Compress(Decompress) Software\Compress(Decompress) Software.sln
文件 26112 2019-01-16 22:35 Compress(Decompress) Software\Compress(Decompress) Software.v12.suo
目录 0 2019-01-16 22:35 Compress(Decompress) Software\Compress(Decompress) Software\
文件 654 2019-01-16 21:22 Compress(Decompress) Software\Compress(Decompress) Software\ClassDiagram.cd
文件 2018 2019-01-16 21:46 Compress(Decompress) Software\Compress(Decompress) Software\Compress(Decompress) Software.cpp
文件 4733 2019-01-16 21:22 Compress(Decompress) Software\Compress(Decompress) Software\Compress(Decompress) Software.vcxproj
文件 1595 2019-01-16 21:22 Compress(Decompress) Software\Compress(Decompress) Software\Compress(Decompress) Software.vcxproj.filters
目录 0 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\
文件 1569 2019-01-10 17:05 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress(Decompress) Software.Build.CppClean.log
文件 2474 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress(Decompress) Software.log
文件 179482 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress(Decompress) Software.obj
文件 2162688 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress(Decompress) Software.pch
目录 0 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress.2C8B577F.tlog\
文件 5686 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress.2C8B577F.tlog\cl.command.1.tlog
文件 23724 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress.2C8B577F.tlog\CL.read.1.tlog
文件 6444 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress.2C8B577F.tlog\CL.write.1.tlog
文件 225 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress.2C8B577F.tlog\Compress(Decompress) Software.lastbuildstate
文件 3982 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress.2C8B577F.tlog\li
文件 6830 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress.2C8B577F.tlog\li
文件 2342 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\Compress.2C8B577F.tlog\li
文件 366600 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\HuffmanTree.obj
文件 12272 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\stdafx.obj
文件 502784 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\vc120.idb
文件 462848 2019-12-19 21:01 Compress(Decompress) Software\Compress(Decompress) Software\Debug\vc120.pdb
文件 12096 2019-01-16 22:35 Compress(Decompress) Software\Compress(Decompress) Software\HuffmanTree.cpp
............此处省略15个文件信息
- 上一篇:基于Qt的智能停车场.rar
- 下一篇:图书信息管理系统 vs 图形界面
相关资源
- 基于Qt的智能停车场.rar
- 小型公司工资管理系统设计.rar
- 基于TCP协议的C/S传输文件C++)
- C++MFC数据库职工信息管理系统,实现
- C++ Concurrency in Action 2nd Edition (2019.
- 数据结构c语言版第2版课后习题答案
- Microsoft Visual C++ 2010 SP1 Redistributable
- funcode 黄金矿工 c++语言
- QT实现视音频实时传输qml+C++
- VC++6.0编程实现MIF文件点集读取与凸壳
- [C++程序设计基础第5版上][周霭如林伟
- C++时钟easyx实现
- 网络编程MFC 实验四 FTP客户端功能实现
- Labview调用C++ dll之字符串数组传递
- C++作业_选课系统
- c++大学课程设计——家教信息系统
- DES算法C++实现.rar
- Microsoft visual c++ 14.0.rar
- 24点游戏:c++版
- C++商品管理系统50页报告+源码。代码
- C++ 图像处理283241
- 校招面试题库附答案与解析C+++篇.ra
- 传智播客C++进阶课程讲义 传智扫地僧
- C++写太阳/月球坐标计算,在地固坐标
- VC++ 人脸识别定位、眼睛、嘴巴和鼻识
- C++ Concurrency in Action中文PDF
- C++文本文件无失真压缩 Huffman
- 航空订票系统C++实现
- 计算机二级VC++2010学习版
- Visual Assist X西红柿插件VC++6.0通用安装
评论
共有 条评论