📄 rar_with_haffman.cpp
字号:
/***************************************************************************
* Copyright (C) 2007 by lijinhui *
* fly_just_now@localhost.localdomain *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "iostream"
#include "math.h"
#include "string.h"
using namespace std;
#include <fstream>
#include "rar_file_with_haffman.h"
int main(int argc, char* argv[])
{
get_the_rar_file();
int i,j,n=N;
HaffNode *myHaffTree= new HaffNode[2*n+1];
Code *myHaffCode =new Code[n];
if(n>MaxN)
{
cout<<"参数越界!"<<endl;
exit(0);
}
Haffman(weight,n,myHaffTree);
HaffmanCode(myHaffTree,n,myHaffCode);
//屏幕输出.
/*for(i=0;i<n;i++)
{
if(char_a[i]=='\n')
{
cout<<"\\n"<<" Weight = "<<myHaffCode[i].weight<<" Code =";
}
else
{
cout<<char_a[i]<<" Weight = "<<myHaffCode[i].weight<<" Code =";
}
for(j=myHaffCode[i].start+1;j<n;j++)
cout<<myHaffCode[i].bit[j];
cout<<endl;
}*/
save_the_rar_ya(myHaffTree,myHaffCode);
cout<<"OK!"<<endl;
/*ifstream test("rar_new_file.txt");
char ch1;
while(test.good())
{
test.get(ch1);
cout<<ch1;
}*/
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -