Advertisement
Guest User

Untitled

a guest
Feb 5th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. int countChar(const std::string &s) {
  2.  
  3. struct ischar {
  4. ischar() {};
  5. ischar(unsigned char x) : x(x) {}
  6. bool operator()(unsigned char y) const {
  7. if (std::isalpha(y))
  8. return true;
  9. else
  10. return false;
  11. }
  12.  
  13. private:
  14. unsigned char x;
  15. };
  16.  
  17. ischar kat;
  18.  
  19. return count_if(s.begin(), s.end(), kat);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement