Question: 1 . Write a C + + program that does the following: a . Create a C + + file with the name problem 3

1. Write a C++ program that does the following:
a. Create a C++ file with the name problem3.cpp.
b. Write the function twoLeftDigitSumusing recursion, which returns the sum of the leftmost two digits of its positive integer parameter.
c. If the parameter is a single digit integer, twoLeftDigitSumreturns that digit.
d. Type in the following main function into your C++ program file:
int main()
{
cout << twoLeftDigitSum(567982)<< endl; // prints 11
cout << twoLeftDigitSum(107982)<< endl; // prints 1
cout << twoLeftDigitSum(7)<< endl; // prints 7
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!