// Count and sum up digits in a string
// Version 1.0
// Date 23:54 08/10/2016
// By Ben a.k.a DreamVB

#include <iostream>
#include <string>

using namespace std;
using std::cout;
using std::endl;
using std::cin;

int main(int argc, char *argv[]){
	int i = 0;
	int sum = 0;
	int d = 0;
	char s0[100];

	cout << "Enter some text and digits : ";
	cin.getline(s0, sizeof(s0));

	while (i < strlen(s0)){
		//Check for digits.
		if (isdigit(s0[i])){
			//INC digit counter
			d++;
			//Sum of digits
			sum += s0[i] - '0';
		}
		i++;
	}
	//Outout results.
	cout << "Digits found     : " << d << endl;
	cout << "Sum of digits is : " << sum << endl;

	system("pause");
	return 0;
}