haffuma.cpp
来自「c 实现的哈夫曼码编译器 sample demo」· C++ 代码 · 共 52 行
CPP
52 行
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
int n;
struct node{
int w;
int flag;
char c;
struct node *plink,*llink,*rlink;
char code[50];
}*num[100],*root;
FILE *fp;
char tmpcode[50];
int t=0;
int main(void)
{
int i;
void settree();
void code();
void decode();
void disp() ;
root=(struct node*)malloc(sizeof(struct node));
puts("*******************hfm edit/encode demonstration******************************");
while(1){
start:
puts("1. Initrialization 2.display the list of decoding 3. end");
while(scanf("%d",&i)!=1)
{
while(getchar()!='\n')
continue;
puts("input errors!");
puts("reinpuf");
puts("1. Initrialization 2.display the list of decoding 3. end");
}
switch (i)
{
case 1:
settree();
break;
case 2:
disp();
break;
case 3:
exit(0);
default:
puts("input errors
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?