i cannot return if some of the strings appear more than once.
i.e i have two vectors and i search the 1st vector with the 2nd vector and if some of the elements from the 2nd vector appear more than once in the 1st vector i want to return an error but for some reason i only can return if the elements in the 1st vector do not appear more than once
my code is below
I want to return s1 when elements have appeared more than once how can i do that i tried having it infront of the break but that did not work
std::vector<std::string> test; //vector that comes in
test.push_back("YES");
test.push_back("YES");
//test.push_back("NO");
test.push_back("NO");
std::vector<std::string> test1; // vector from DB..
test1.push_back("YES");
test1.push_back("NO");
std::string s ("Element count is fine");
std::string s1 ("Element count is incorrect");
for(int i = 0; i < test1.size(); i++)
{
if(count(test.begin(), test.end(),test1[i]) > 1)
{
return s1;
}
}
return s;