哈弗曼编译码器

来源:百度知道 编辑:UC知道 时间:2024/09/24 06:52:06
给出源程序 给出需求分析 概要 流程图 就是实验报告的形式 不要CSDN 在别的网站载的也行 急用 谁给个 谢了
NND 有这么难吗 一个人都不来啊!!

#include<stdio.h>
#include<conio.h>
#include<malloc.h>
#include<string.h>
#include<stdlib.h>

#define ERROR 0;
#define OK 1;

typedef int Status;

typedef struct{
unsigned int weight;
int key;
int parent,lchild,rchild;
}HTNode,*HuffmanTree;

typedef char * * HuffmanCode;

int **KEY;
int N;

Status GetData(){
FILE *fp;
int key[100][2];
int ch,k,i,tem;
char str[16];
fp=fopen("data.txt","r");
k=0;

while(!feof(fp)){

ch=fgetc(fp);
i=0;
while(ch!=' '){
str[i]=ch;
i++;
ch=fgetc(fp);
}
str[i]='\0';
//printf("%d\n",strcmp(str,"空格"));
if(!strcmp(str,"空格")){

key[k][0]=' ';
}
else{
key[k][0]=str[0];

}