I need to count the number of digits in a series of strings. I have found the isdigit(ch) function in the cctype header but I am not sure of how to use it. I googled it and did not find any useful information that would help me understand it. If I understand it correctly it returns true if digit between 0-9 and false otherwise. I guess the problem I am having is applying this by checking each character in a string and counting.
1 2 3 4 5 6 7 8
void count_digit(string& word)
{
int wlength;
char ch;
wlength = word.length();
for (int i=1; i<wlength; i++)
{
}
thats all i have come up with i'm not sure how to go through each character and then sum up the digits. I guess I can use a runnig counter but the true/false is throwing me off. any assistance would be greatly appreciated.