#include<iostream>
#include<list>
#include<string>
#include<iterator>
#include<algorithm>
using namespace std;
void print(const list<string> &l)
{
cout << "The list elements are : ";
copy(l.begin(), l.end(), ostream_iterator<string>(cout, " "));
cout << endl << endl;
}
int main()
{
list<string> l = { "blue","red","black","yellow","green","gold","silver","pink","orange","brown" };
print(l);
list<string>::iterator it;
system("pause");
return 0;
}
I had to create a list of 10 words. I created it and made the print function. But the problem is that for my school project I have to find all the words starting with b
and the next one is that I have to find all the words which length is 4 symbols (for example blue). Thank you in advance for your help!