Question: C++ Help. Write the function that counts the number of occurrence of a specific decimal digit in a string For example: int countDigit(int, string )
C++ Help.
Write the function that counts the number of occurrence of a specific decimal digit in a string
For example:
int countDigit(int, string ) ; // Function prototype
int main()
string str = "12314561asd vd&*1";
int digit = 1;
int cnt = countDigit(1, str);
// Expected output : Number of 1 in the string is 4
cout << "Count of digit " << digit << " in the string is " << cnt;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
