Question: ***C++**** int main(int argc,char *argv[]) { string filename; const string END_OF_BOOK_DATA = ***************; string title, body, line; filename=argv[1]; ifstream infile(filename.c_str()); if(infile.fail()){ cout < < ERROR:
***C++****
int main(int argc,char *argv[]) {
string filename;
const string END_OF_BOOK_DATA = "***************";
string title, body, line;
filename=argv[1];
ifstream infile(filename.c_str());
if(infile.fail()){
cout << "ERROR: could not open input file " << filename << endl;
return 1;
}
// HashTable blist;
ZippedBookNode *here=new ZippedBookNode;
Utils *here2;
int i=0;
HashTable<4> myHashTable;
while(getline(infile, title)){
title = title.substr(1);
body = "";
while(getline(infile, line)){
if(line == END_OF_BOOK_DATA)
break;
body += line + " ";
}
string encodedString;
here2->computeFrequency(body, body.length());
here2->HuffmanCodes(body.length());
for (auto i: body) encodedString+=codes[i];
//here2->decode_file(minHeap.top(), encodedString);
here[i].title=title;
here[i].c_excerpt=encodedString;
here[i].huff_root=minHeap.top();
here[i].next=NULL;
//cout< cout< i++; cout< // myHashTable.insertNode(here); } cout< infile.close(); for(int i=0;i<4;i++){ cout< } myHashTable.insertNode(here); // myHashTable.printTitles(); cout<<"!"< return 0; } ************************************************************************************************************* As you see the part ::: here[i].title=title; here[i].c_excerpt=encodedString; here[i].huff_root=minHeap.top(); here[i].next=NULL; I am unble to add data on here node. It only loops like once and all I can save is data for i=0; but I can't move fuether. Can you help me out??? Can you go through this code?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
