Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- const int MAX_SIZE = 100;
- int numberOfDigits(char string[], int &counter, int size, int i)
- {
- if (string[i] >= '0' && string[i] <= '9')
- counter++;
- if (i == size)
- return counter;
- i++;
- numberOfDigits(string, counter, size, i);
- }
- int main()
- {
- int counter = 0;
- char string[MAX_SIZE];
- cout << "Enter the string: " << endl;
- cin >> string;
- int size = strlen(string);
- cout << numberOfDigits(string, counter, size, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement