Hi, I've been trying to create a C++ program that gets the input from the user, calculates the amount of digits in the array and then calculates the sum of the digits

Heres what i've got so far

```
int main()
{
char num[100];
cout << "\nEnter Number: ";
cin >> num;
int counter = 0;
for (int i = 0; num[i] != '\0'; i++)
counter += 1;
cout << counter << endl;
int sum = 0;
for (int a = 0; num[a] != '\0'; a++)
{
num[a] = num[a] = '0';
sum += num[a];
}
cout << sum;
return 0;
}
```

but i cant seem to find the sum of the digits