I want to get the sum of the individual digits of an ID entered by the user. So far this is the code I have, and my code can count the number of characters in the user input but I'd like for it to also calculate the sum of the individual digits.
// user prompt for student id
cout << "Type in your student login ID: ";
string studentId;
// user input of student ID
getline(cin, studentId);
// computer output of studentId
cout << "Student ID Sum: " << studentId.length() << endl;