I have two 2d vectors. Both have a column of strings. I have to match both columns based on number of characters matched counted in an order.
All the Elements in both the columns are compared first.
Then character by character comparison is done in such a way that, if a character from the 1st string(from first vector) is found in any part of 2nd string(from second vector), all the previous characters in 2nd string are ignored in further comparisons of those two strings. All the further comparisons must be made from that matched character. The same should be true in all the future comparisons
i.e for example: if there is a word 'Tennessee' in 1st string and 'east tennessee' in second string, character by character search is done. when the T's are matched, while comparing the next alphabet e, the e in east should be ignored, only alphabets after the t should be considered and so on.
the number of characters are to be counted and displayed along with the matched strings.
There can be spaces in the string,
I have tried it, I am not getting errors but i could get any output displayed.
I guess the fault in my code is because of spaces inbetween words,
Can anyone please help me with this, I have to submit it today :(
I am pasting that part of my code:
for (int p = 0; p < array1.size(); p++)
{
for (int e = 0; e < array2.size(); e++)
{
s=0;
count = 0;
int length1 = array1.at(p).at(2).length();
int length2 = array2.at(e).at(2).length();
for (int l = 0; l < length1; l++)
{cout << array1.at(p).at(2)[l] << " " << array2.at(e).at(2)[s] << " r compared \n";
while(array1.at(p).at(2)[s])
{
//cout << array1.at(p).at(2)[l] << " " << array2.at(e).at(2)[s] << " r compared \n";
if(array1.at(p).at(2)[l] == array2.at(e).at(2)[s])
{
count++;
}
s ++;
}
}
cout << "still looping" << p << " \n";
}
}