| Radio370Z (1) | |
|
i want to be able to add to the frequency of a word in a text file. But as the function i have below finds a function i want it to add to the frequency each time the words is found again. int BinTree::find(string word) { BinNode *temp=root; bool found=false; while(!found && temp!=NULL) { if(temp->data==word) { found=true; temp->data_num+1; } else if(word<temp->data) temp=temp->left; else temp=temp->right; } //return temp->data_num; return 0; } if i return the commented out code it will give me a error. | |
|
|
|
| tgiec (14) | |
|
Is the statement (in bold font) in proper logic? while(!found && temp!=NULL) { if(temp->data==word) { found=true; temp->data_num+1; } else if(word<temp->data) temp=temp->left; else temp=temp->right; } What error you got while returning the commented out code? | |
|
Last edited on
|
|