The class does chores in groups by first letter. Write starts_with(names, letter) to put the names that begin with letter into a new vector, in the same order, and return it. No name is empty, and each starts with a capital.
starts_with({"Amy", "Bob", "Ann"}, 'A')→['Amy', 'Ann']starts_with({"Bob"}, 'Z')→[]vector<string> starts_with(const vector<string> &names, char letter)#include <string>
#include <vector>
using namespace std;
vector<string> starts_with(const vector<string> &names, char letter) {
vector<string> found;
for (const string &name : names) {
// your code here: if name starts with letter, put it in found
}
return found;
}
Run tries the examples. When they look right, Submit.