fork download
  1. #include <vector>
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <ctype.h>
  5.  
  6. template <typename T>
  7. bool isLowerCased(const T& elem)
  8. {
  9. return std::all_of(elem.begin(), elem.end(), ::islower);
  10. }
  11.  
  12. bool isLowerCased(char c)
  13. {
  14. return ::islower(c);
  15. }
  16.  
  17. bool isLowerCased(const char* cstr)
  18. {
  19. return isLowerCased(std::string(cstr));
  20. }
  21.  
  22.  
  23. int main()
  24. {
  25. std::cout << std::boolalpha
  26. << isLowerCased(std::string("something")) << '\n'
  27. << isLowerCased(std::vector<char>{'a','b','c'}) << '\n'
  28. << isLowerCased("something") << '\n'
  29. << isLowerCased('a') << '\n';
  30.  
  31. std::cout << isLowerCased("sometDFShing") << '\n'
  32. << isLowerCased('C') << '\n';
  33. }
  34.  
Success #stdin #stdout 0s 3020KB
stdin
Standard input is empty
stdout
true
true
true
true
false
false