If I have a vector of structs
struct widgets
{
string widgetName;
int age;
int color;
};
and widgetName had multiple words in lets say
widget one type
45
blue
widget two
34
yellow
widget eight
46
green
widget ten type
33
pink
and I wanted to search the vector where this information is stored.
vector<widgets> widgetTypes;
Now what I want to do is search through the vector and only find the widgets with the word "type" in it then I want to compare the widgets that have "type" in it and see which one has the highest age. Then I want to output that widget i.e. the widget with the highest age is "widget one type" with an age of "45"?
I know I should use a find and probably npos but kind of unsure if I am right and how to set up the code.