Solved

Compare string content in 2 vectors

Posted on 2004-05-02
Medium Priority
322 Views
Hi, exert.

I have 2 vectors with the same elements:

vector1 { ID, name, phone }
vector2 { ID, name, phone }

and 1 vector which conisists of both elementS from vector1 and vector2
vector3 {ID1, ID2, name, phone1, phone2}

I want to find if the element "name" in these vector1 and vector2 are equal
i.e.
if vector 1 contain an element:
ID[1],  name[Grace],  phone[12345]
and vector 2 also contain an element:
ID[4],  name[Grace],  phone[99999]

I will add a new element in vector3, i.e.
ID[1], ID[2], name[Grace],  phone[12345],  phone[99999].

Are there any function in vector can do these in an more effiecient way ?

Thanks

0
Question by:vincehon
• 2

LVL 92

Accepted Solution

objects earned 375 total points
ID: 10974089
for (int i=0; i<3; i++)
{
if (vector1.get(i).equals(vector2.get(i)))
{
}
}
0

LVL 92

Expert Comment

ID: 10974162
0

Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.