帮忙看下此程序错在哪

来源:百度知道 编辑:UC知道 时间:2024/08/21 19:13:03
http://zhidao.baidu.com/question/1197739.html?si=5程序在这里,是最佳答案里面那个程序,错误信息如下:
e:\jjklllll\ggt.cpp(152) : fatal error C1010: unexpected end of file while looking for precompiled header directive
执行 cl.exe 时出错.

ggt.obj - 1 error(s), 0 warning(s)

朋友,估计你复制错了,把原本不是代码的内容都复制到VC++当中去了
我复制后没有错误,建议你再复制下我粘贴的试试:
#include "iostream"
#include "iomanip"
#include "string"
using namespace std;

#define MAX 256
typedef string *STR;

void InputData(string &s);
void DeCode();

typedef struct Huffnode {
unsigned weight; //权值 字符出现频率
bool in; // 是否加入Huffman树
int lchild,rchild;
void Set(unsigned &w,int lc=-1,int rc=-1,bool in = false ) {
weight = w;
lchild = lc;
rchild = rc;
in = in;
}
Huffnode() { weight=0; in = false;lchild=-1;rchild=-1;}
} *HuffTree;

void GetCode(HuffTree &nodes,int &k,STR &Code,string &str,int i,int leafNum,unsigned *Ind) {
if (k<leafNum) {
Code[Ind[k]] = str.substr (0,i);
return;
}
str[i] = '0';
GetCode(nodes,nodes[k].lchild ,Code,str,i+1,leafNum,Ind);
str[i] = '1';
GetCode(nodes,