Hi. Can anyone help me get started with the following program please? I know the concept but i am having problem writing the syntax codes.

I know we have to use arrays and then split the array and convert it into string and then back to integer. I believe we also have to use a loop. But i am not able to write the codes for the program. Please please help me.

Write a program that will calculate the under-10 total of a number of integers. The following example will illustrate

the process:

We need to get the under-10 total of 93, 42 and 33.

- Add the individual digits of the first integer together (thus 9+3 = 12)

- If the total is greater than 9 (which it is in this case), repeat the process (thus 1+2=3) until the total is less

than 10. This is the first running total.

- Then repeat the process for the second integer (thus 4+2 = 6).

- Now add the under-10 total of the first integer to that of the second integer and repeat the process if the

running total is greater than 9 (thus 3+6=9).

- Get the under-10 of the third integer (thus 3+3=6) and add to the previous running total and repeat the

process to get a total less than 10 (thus 9+6=15; 1+5=6).

- The under-10 total of the three integers 93, 42 and 33 is therefore equal to 6.

Create an input file called input.dat that contains the following set of integers:

39 88 55 21 90 77 24 67 76 87 35 79 45 93

You can assume that there will be at least 2 integers in the file and that all integers in the file will have two

individual digits. Your program needs to read one integer at a time from the file, and then use the operators of C++

(e.g. +, - , /, %, which ever is applicable) to separate the digits and do the calculations. Write the running totals to an

output file called under10.dat. The last integer in the output file will therefore be the under-10 total of all the

integers in the input file.

Hint: If you divide a two-digit integer by 10, the result will be the first digit, e.g. 28 / 10 = 2. If you use the modulus

operator (%) on a two-digit integer and the value 10, the result will be the second digit, e.g. 28 % 10 = 8. You

now have the digits 2 and 8 separated, and can add them together. The sum in this example is 10, which is

more than 9, so we repeat the process. 10 / 10 = 1, giving the first digit, and10 % 10 = 0, giving the second

digit. Now 1 + 0 = 1, which is a valid under-10 total.

For the above input file the output file should be:

3 1 2 5 5 1 7 2 6 3 2 9 9 3