ok ich habe nun das hier:
#include <string>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
#include <functional>
#include <cctype>
#include <iterator>
using namespace std;
bool is_sorted( string const& s ) {
string c = s; // Kopie von s erstellen
sort( c.begin(), c.end() ); // Kopie sortieren
//int strcmp ();
cout << s << c << endl;
//while (strcmp ( s, c) !=0);
return c == s; // Vergleichen
cout << s << endl;
}
static struct transform_helper :unary_function < string, string> {
string operator () (string &value) {
int i=0;
//Iterate through each character of entire string
while (value[i]) {
//Change character to lowercase
value[i] = tolower(value[i]);
i++;
}
return value;
}
} transform_helper;
int main () {
vector <string> vec;
ifstream stream ("wordorder.txt");
if (!stream) {
cout << "Can't open file" << endl;
return 1;
}
//read the wordlist into the vector
copy (istream_iterator <string> (stream), istream_iterator <string> (), back_inserter(vec));
//sort the list
sort (vec.begin (), vec.end () );
//convert all letters to lower case
// for_each (vec.begin (), vec.end (), transform);
transform (vec.begin (), vec.end (), vec.begin (), transform_helper);
//sort (value.begin (), value.end ());
bool is_sorted(string );
}[/PHP]