I am programming in C++ and am attempting to find the intersection of two strings, only the items common to both and thus return a third string with these items. Essentially, I am trying to write
the code for the STL library set_intersection.
To approach this problem I thought of I can use two nested loops one loop to cycle thru each string. Then having a variable to compare values in common, which means I would
have to have a temp variable to store common elements.
something similar to this:
string names[] = {"AMC", "ANZ", "AMX"};
for( int i = 0; i < 3; i++ ) {
for( int j = 0; j < 3; j++ ) {
cout << names[i].compare(names[j] ) << " ";
}
cout << endl;
}
Any further sugestions would be great,
Thanks,
I