As the title states, Im writing a program to find the occurances of a digit in a number. both are entered by the user.
this is what i got so far:
#include <iostream>
#include <string>
using namespace std;
int main()
{
int userNum;
int digCount;
int digSum;
cout << "Please enter your number:" << endl;
cin >> userNum;
cout << "Enter the digit you want to count:" << endl;
cin >> digCount;
if (digCount <= 0 || digCount > 9)
{
cout << "You entered an invalid counter!" << endl;
}
cout << "Number of occurances for your digit is:" << digSum << endl;
}