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

1. Write a C++ program that does the following:
a. Create a C++ file with the name problem2.cpp.
b. Write the function thirdDigit using recursion, which returns the third digit from the left of its positive integer parameter.
c. If the parameter is less than 100, then the function returns 0 because there is no third digit.
d. Type in the following main function into your C++ program file:
int main()
{
cout << thirdDigit(347)<<"";
cout << thirdDigit(2048)<<"";
cout << thirdDigit(560125)<< endl;
// This code should print:
//740
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!