Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- bool CheckingNumbers(const string&);
- int main() {
- setlocale(LC_ALL, "rus");
- string s1 = "123";
- string s2 = "asd";
- string s3 = "123asd";
- string s4 = "asd123";
- cout << CheckingNumbers(s1) << endl;
- cout << CheckingNumbers(s2) << endl;
- cout << CheckingNumbers(s3) << endl;
- cout << CheckingNumbers(s4) << endl;
- return 0;
- }
- bool CheckingNumbers(const string& s) {
- bool b = true;
- for (auto& a : s) {
- if (!iswalnum(a)) {
- b = false;
- break;
- }
- }
- return b;
- };
- 1
- 0
- 0
- 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement