fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. bool compare0(char a, char b){
  8. //default sorting (currently what World of Tanks uses, apparently)
  9. return a<b;
  10. }
  11.  
  12. bool compare1(char a, char b){
  13. //case-insensitive sorting alphabetically, but doesn't consider numeric digits or other characters
  14. return a%32<b%32;
  15. }
  16.  
  17. bool compare2(char a, char b){
  18. //case-insensitive sorting alphabetically, and does consider numeric digits and other characters
  19. return (a>64?a%32+64:a)<(b>64?b%32+64:b);
  20. }
  21.  
  22. int main(){
  23. string names="QW6ERTYUI7OPASqwertyu3iopDFzxcvbnm124GHJKasdfghjk5l9LZX8CVBN0M";
  24. string
  25. names0 = names,
  26. names1 = names,
  27. names2 = names;
  28. sort(names0.begin(),names0.end(),compare0);
  29. sort(names1.begin(),names1.end(),compare1);
  30. sort(names2.begin(),names2.end(),compare2);
  31. cout << "First comparator: \t" << names0 << endl;
  32. cout << "Second comparator: \t" << names1 << endl;
  33. cout << "Third comparator: \t" << names2 << endl;
  34. return 0;
  35. }
Success #stdin #stdout 0s 2860KB
stdin
Standard input is empty
stdout
First comparator: 	0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
Second comparator: 	aABbCcDdEefFgGhHIiJjKkLlmMNnOo0PpQ1q2RrSs3tT4uU5vV6W7wX8x9YyZz
Third comparator: 	0123456789aAbBCcdDeEfFGgHhiIJjKklLMmnNOopPQqrRSstTuUvVwWxXYyZz