Playground
//koristi C++11 - http://mendo.mk/Lecture.do?id=26 #include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; int compare_lowercase(string a, string b) { string lowercase_a = a; for(char &ch : lowercase_a) ch = tolower(ch); string lowercase_b = b; for(char &ch : lowercase_b) ch = tolower(ch); return (lowercase_a < lowercase_b); } int main() { vector<string> names = { "beta", "alpha", "Delta", "Sigma" }; sort(names.begin(), names.end(), compare_lowercase); for (auto name : names) { cout << name << endl; } return 0; }
Input data
Program output
Execute
Language: ????????? | Memory: ???? KB | Time: ??? ms
Nothing has been executed, yet!