Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cctype> // для функции isdigit
- #include <locale.h>
- #include <string>
- int ggg(string);
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- string a;
- cout << "введите положительное целое число : ";
- cin >> a;
- ggg(a);
- while (ggg(a) != 0) {
- cin >> a;
- }
- system("pause");
- return 0;
- }
- int ggg(string a) {
- int b;
- b = a.length();
- int k = 0;
- for (int i = 0; i < b; i++) {
- if (isdigit(a[i])) continue;
- else {
- cout << "ошибка" << endl;
- k = 1;
- break;
- }
- }
- return k;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement