j<29;j++)Huffcode[i].Bit[j]=cd.Bit[j]; Huffcode[i].Start=cd.Start; } fstream fp; fp.open("b.txt",ios::out); if(!fp) { cout <<" 文件打开失败!\n"; exit(0); } for(i=0;i<29;i++){ fp<<Huffnode[i].weight; fp<<Huffnode[i].c; for(j=Huffcode[i].Start+1;j<29;j++) fp<<Huffcode[i].Bit[j]; fp<<"#\n"; } fp.close(); fstream node; node.open("c.txt",ios::out); fp.open("a.txt",ios::in); if(fp.fail()) { cout <<" 文件打开失败!\n"; exit(0); } while(!fp.eof()){ fp.get(z); for(i=0;i<29;i++) if(z==Huffnode[i].c||z==Huffnode[i].c-32) for(j=Huffcode[i].Start+1;j<29;j++) node<<Huffcode[i].Bit[j]; node<<"#"; } fp.close(); node.close(); cout<<" 递归中序遍历"<<endl; IN(2*29-2,29); htree(); } void htree(){ int i,j,k,n,l[2000]; char h; fstream fp,w; fp.open("c.txt",ios::in); if(!fp) { cout <<" 文件打开失败!\n"; exit(0); } i=0; while(!fp.eof()){