My code is returning zero instead of actually counting the number of instances of the digit that are actually in the number. I am confused about what I have done wrong.
int number_times_appear(int digit, int number)
int total = 0;
string stringNumber = to_string(number);
char charDigit = digit;
total = count(stringNumber.begin(), stringNumber.end(), charDigit);
cout << total;