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

1. Write a C++ program that does the following:
a. Create a C++ file with the name problem5.cpp.
b. Write the function sumCubesusing recursion, which computes the sum of the cubes of the integers from 1 to n, where n is the integer parameter.
c. If n is less than or equal to zero, then sumCubesreturns 0.
d. Type in the following main function into your C++ program file:
int main()
{
cout << sumCubes(5)<< endl; // prints 225
cout << sumCubes(8)<< endl; // prints 1296
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!