Could you maybe alter it a bit so it takes in my parameters? That would be a perfect solution to my problem.
Type: Posts; User: Todd88
Could you maybe alter it a bit so it takes in my parameters? That would be a perfect solution to my problem.
Wow that's perfect. Don't really have a clue about how it works though. :( Would be perfect for this project though.
I'm sure it is a waste of time but I haven't learned maps yet :(
Oh wait no. That is what it does now which is bad. Sorry, didn't read it close enough. Trying to get rid of that. It prints out like 100 of the same string. I am trying to fix it by doing a binary...
That's exactly what is SHOULD do :D
No there is no error. It just doesn't add to the vector correctly.
Okay why can't I do this:
void Index::addWord(string word, int pageNumber)
{
if(word.length() > 3)
{
indexWord index;
for (vector<indexWord>::iterator...
and the binary_search algorithm should work too correct? It does work for me though.
binary_search (data.begin(), data.end(), word)
right?
I overloaded the operator < using:
bool indexWord::operator< (indexWord& string)
{
return value < string.value;
}
It's still telling me that there is no match for operator <
This still sorts the characters of the string value instead of sorting the "data" vector by the string value.
So this should work right?
void Index::addWord(string word, int pageNumber)
{
indexWord index;
if(word.length() > 3)
{
index.value = word;
...
I need to order if first before using lower_bound(). I need to order it by the string word.
Alright I just need an addInOrder and binarySearch algorithm for the index vector. That's it and I'm done!!! But yet again...I'm lost.
The pages vector is inside the struct indexWord and the indexWord vector is inside the class Index though. I am really sorry but I just don't get it! I am sure this is simple stuff but I don't get...
I don't know how to search through the vector of a vector and a string. I also don't know how to output the vector containing the page numbers that's in the vector.
I have a condition in my addWord function that doesn't add the words if they are 3 letters or less. Plus this sounds really complicated sorting the vector even though I need to. How do I do this? I...
Alright I finally got it working. Now how to I look through the vector and output it according to first word?
Why is this not getting every single line of the book, the page number, and storing it in the vector?? This is the driver file that runs through the file, gets the line, strips the line into words,...
Alright I got it working. Now how to a output these values in the array according to their first letter?
nothing right now. just trying to see if that line of code works and it spit out that error.
data is the vector...
What tabstop just gave me:
for (vector<indexWord>::iterator current=data.begin(); current!=data.end(); ++current)
invalid conversion from `const indexWord* const' to `indexWord*'|
||=== Build finished: 1 errors, 0 warnings ===|
Yeah I need to loop through the data vector to output the "value" and vector of locations using the data vector. I don't know how to do this.
Okay I am implementing an index of words from an input text file. I have a class that contains a vector declared like this:
vector<indexWord> data;
and a struct declared like this:
...