AVL tree help - C++

I need help with two functions. One I need my OSTREAM to upload into a AVL tree. what am i doing wrong? my output keeps coming back size() =0

also i thnk it is failing because my getword() function is returning a empty string (" "). please assist if you can...

//****************************************************************************************

// DocumentIndex::Write

//****************************************************************************************

void DocumentIndex::Write(ostream& indexStream)

{

WordData wordData;

WordMapIterator wordIterator;

WordMapStatus wordStatus;

WordMap wordMap_;



cout << "Size " << wordMap_.size() << endl;



for (wordIterator = wordMap_.begin(); wordIterator != wordMap_.end(); ++wordIterator)

{

cout << wordIterator->first << " " << &wordIterator->second << endl;

}

return;

}

//****************************************************************************************

// DocumentFile::GetWord

//****************************************************************************************

string DocumentFile::GetWord()

{

StringSize beginPosition_;

StringSize endPosition;

StringSetIterator iterator;

StringSize position;



bool isLegal;

string word;

string legalBack = ".,:;)\"'";

string legalFront = "(\"'";

string letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

while (true) {





beginPosition_ = text_.find("\t", beginPosition_);



if (beginPosition_ == string::npos)

{

word.erase();

break;

}

endPosition = text_.find(" \t", beginPosition_);

if (endPosition != string::npos)

{

word.assign(text_, beginPosition_, endPosition - beginPosition_);

beginPosition_ = endPosition +1;

}

else

{

word.assign(text_, beginPosition_, text_.size());

beginPosition_ = text_.size();

}

position = legalFront.find(word.front());

if (position != string::npos)

{

word.erase(0,1);

}

position = legalBack.find(word.back());

if (position != string::npos)

{

word.pop_back();

}

isLegal = true;

for (uint64_t i =0; i < word.size(); ++i)

{

position = letters.find(word[i]);

if (position == string::npos)

{

isLegal = false;

}

}

iterator = exclusion_.find(word);

if (iterator != exclusion_.end())

{

isLegal = false;

}

if (isLegal)

{

break;

}

}



return(word);

}

//****************************************************************************************
my output keeps coming back size() =0
In your Write(...) function wordMap_ is a local variable that does not have any content. If this variable would exist in DocumentIndex that member variable will not be used.

In GetWord() beginPosition_ will also be empty/uninitialized.
Registered users can post here. Sign in or register to post.
<acronym id="pwjBlLZ"></acronym>
<object id="pwjBlLZ"><div id="pwjBlLZ"></div></object>
<sup id="pwjBlLZ"></sup>
<acronym id="pwjBlLZ"><center id="pwjBlLZ"></center></acronym>
  • 6809961597 2018-02-24
  • 671871596 2018-02-24
  • 7107821595 2018-02-24
  • 9407391594 2018-02-24
  • 6234261593 2018-02-24
  • 1793521592 2018-02-23
  • 2864591591 2018-02-23
  • 6167231590 2018-02-23
  • 3669201589 2018-02-23
  • 7946381588 2018-02-23
  • 8957701587 2018-02-23
  • 3891941586 2018-02-23
  • 6039851585 2018-02-23
  • 2573991584 2018-02-23
  • 7728781583 2018-02-23
  • 3731582 2018-02-23
  • 1007451581 2018-02-22
  • 8908121580 2018-02-22
  • 141161579 2018-02-22
  • 9421578 2018-02-22