Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. bool CheckingNumbers(const string&);
  7.  
  8. int main() {
  9.  
  10. setlocale(LC_ALL, "rus");
  11.  
  12. string s1 = "123";
  13. string s2 = "asd";
  14. string s3 = "123asd";
  15. string s4 = "asd123";
  16.  
  17. cout << CheckingNumbers(s1) << endl;
  18. cout << CheckingNumbers(s2) << endl;
  19. cout << CheckingNumbers(s3) << endl;
  20. cout << CheckingNumbers(s4) << endl;
  21.  
  22.  
  23. return 0;
  24. }
  25.  
  26. bool CheckingNumbers(const string& s) {
  27. bool b = true;
  28. for (auto& a : s) {
  29. if (!iswalnum(a)) {
  30. b = false;
  31. break;
  32. }
  33. }
  34. return b;
  35. };
  36.  
  37. 1
  38. 0
  39. 0
  40. 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement