main.cpp

来自「利用shannon定理对文件进行压缩与解压缩」· C++ 代码 · 共 55 行

CPP
55
字号
#include <string.h>
#include <iostream.h>
#include "redfun.h"
#include "unredfun.h"

void main(int argc,char *argv[])
{
if(argc==0 || argc!=4)
	{
		cout<<"reduce /O:opt SrcFile DstFile"<<endl;
		cout<<'\t'<<"/O"<<'\t'<<"指定操作选项开关"<<endl;
		cout<<'\t'<<"opt"<<'\t'<<"c  压缩"<<endl;
		cout<<'\t'<<'\t'<<"e  解压缩"<<endl;
		cout<<'\t'<<"SrcFile"<<'\t'<<"指定待压缩(或解压缩)的源文件名"<<endl;
		cout<<'\t'<<"DstFile"<<'\t'<<"指定将要生成的目标文件名"<<endl;
	}
	else
	{
		if(argv[1][3] == 'c')
		{
			FReduce a(argv[2]);
			if(!a.FCoding())
			{
				cout<<"file coding error!!"<<endl;
			}
			if(!a.FReduceSaving(argv[3]))
			{
				cout<<"file reduce saving error!!"<<endl;
			}
			a.TestResult(argv[2], argv[3]);
		}
		else
		{
			if(argv[1][3] == 'e')
			{
				FUReduce b(argv[2]);
				if(!b.ReadFHead())
				{
					cout<<"reading file head error!!"<<endl;
				}
				else
				{
					b.CreatDecodeTree();
					b.UnReduceSaving(argv[3]);
				}
				b.TestRusult();
			}
			else
			{
				cout<<"参数错误,请输入reduce后按回车参考帮助。"<<endl;
			}
		}
	}
}

⌨️ 快捷键说明

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