Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

be aware that your programs should not be written entirely in the main function.

ID: 1812207 • Letter: B

Question

be aware that your programs should not be written entirely in the main function...should use function call !!!

Write a program that asks the user to enter a series of single digit numbers with nothing separating them. Read the input as a C-string or a string object. The program should display the sum of all the single-digit numbers in the string. For example, if the user enters 2514 (as a string not an integer), the program should display 12, which is the sum of 2, 5, 1, and 4. The program should also display the highest and lowest digits in the string.

Explanation / Answer

#include "stdafx.h" #include #include #include int countDigitsInInteger(int n) { int count =0; while(n>0) { count++; n=n/10; } return count; } using namespace std; int main(int argc, char *argv[]) { int intLength =0; int number; int digit; int sum = 0; string s; cout >number; cout