#include <iostream>
#include <vector>
std::vector<std::string> getUniqueBrands(const std::vector<std::string>& brand1, const std::vector<std::string>& brand2)
{
throw std::logic_error("yet to be implemented");
}
int main()
{
std::vector<std::string> brand1 = {"LOUIS_VUITTON", "HERMES", "PRADA");
std::vector<std::string> brand2 = {"GUCCI", "PRADA", "HERMES");
std::vector<std::string> result = getUniqueBrands(brand1 , brand2);
for(auto element : result)
{
std::count << element<< ' ';
//should print GUCHHI HERMES LOUIS_VUITTON PRADA
}
}
#include <iostream>
#include <vector>
#include <string>
std::vector<std::string> getUniqueBrands(const std::vector<std::string>& brand1, const std::vector<std::string>& brand2)
{
std::vector<std::string> result;
for (auto element : brand2)
{
if (element != "PRADA")
result.push_back(element);
}
for (auto element : brand1)
{
if (element != "HERMES")
result.push_back(element);
}
return result;
}
int main()
{
std::vector<std::string> brand1 = { "LOUIS_VUITTON", "HERMES", "PRADA" };
std::vector<std::string> brand2 = { "GUCCI", "PRADA", "HERMES" };
std::vector<std::string> result = getUniqueBrands(brand1 , brand2);
for (auto element : result)
{
std::cout << element << ' ';
//should print GUCHHI HERMES LOUIS_VUITTON PRADA
}
}
Comments
Leave a comment