fork download
  1. #include <algorithm>
  2. #include <cctype>
  3. #include <string>
  4. #include <iostream>
  5.  
  6. int main()
  7. {
  8. std::string test = "abc123";
  9. if ( std::none_of(test.begin(), test.end(), ::isdigit))
  10. std::cout << "All good\n";
  11. else
  12. std::cout << "You've entered an integer\n";
  13. test = "abcdef";
  14. if ( std::none_of(test.begin(), test.end(), ::isdigit))
  15. std::cout << "All good\n";
  16. else
  17. std::cout << "You've entered an integer\n";
  18. }
  19.  
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
You've entered an integer
All good