I've got something like this. The problem is strings must be letters only, how can I do this? I've been sitting over this for few hours now and can't find any working solution. I've tried to use answers from this topic Accept only letters but I guess I'm too dumb and still can't make it work :(
#include <string>
#include <vector>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
int main(void)
{
vector <string> strings;
string line;
do
{
cout << "enter string, 'stop' stops: ";
cin >> line;
strings.push_back(line);
}
while (line != "stop");
vector <string> :: iterator w;
cout << "Before sorting \n";
for (w=strings.begin(); w!=strings.end(); w++)
cout << *w << endl;
sort (strings.begin(),strings.end());
cout << "After sorting \n";
for (w=strings.begin(); w!=strings.end(); w++)
cout << *w << endl;
}