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

📄 package.cpp

📁 使用半适应的huffman算法实现了文件的压缩和解压
💻 CPP
字号:
#include <string>
#include <iostream>
#include "encodetree.h"
#include "decodetree.h"

using namespace std;

void compress(const char* filepath){
	encodetree h(filepath);
	h.buildTree();
//	h.showState();
}

void uncompress(const char* filepath){
	decodetree d(filepath);
	d.decodePro();
}

void command(void){
	FILE* fp;
	string list;
	int rt;
	time_t t;

	

	cout << "Programme Initial..." << endl; // \r
	cout << "Please Enter the Command..." << endl << endl;

	while(1){
		cin >> list;
		if(list.substr(0,5) == "compr"){	//压缩指令
			cin >> list;
			rt = fopen_s(&fp,list.c_str(),"r");
			if(rt == 2)
				cout << "Can't Find this file!" <<endl;
			else{
				fclose(fp);
				cout << "Compressing..." << endl;
				compress(list.c_str());
				cout << "All Done!" << endl;
			}
		}
		else if(list == "exit")
			break;
		else
			cout << "Unknown Command. Use Command 'man' for help!" << endl;
	}
}

⌨️ 快捷键说明

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