The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Could someone please assist me by completing the attached assignment? Â I compiled the program and received the "Result is 55", and I understand that this program returns the sum of the elements of the array in recursive fashion, but I am having some difficulty understanding what is what when it comes to the breakdown of the code. Â I tend to learn better by reverse engineering things, so any help in completing this assignment would be much appreciate. Â Thank you!
Â
Interpret a Program and Explain How it WorksIn the textbook, on page 400, solve problem 7.18: What does the following program do?. Copy the sample program and compile it, then find the results. Submit a report which is more than one page length to explain how the program works and how you can improve it. Write comments in C++ comments format in the source file, to explain what the functions are and how they work. Submit your source code file and the executable file by Day 7.//Ex. 7.18: Ex07_18.cpp//What does this program do?#include <iostream>using std::cout;using std::endl;int whatIsThis ( int [], int); //func±on protoypeint main(){const int arraySize = 10;int a [arraySize] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};int result = whatIsThis (a,arraySize);cout << "Results is " <<result << endl;return 0; //indicates successful termina±on} // end main//What does this func±on do?int whatIsThis ( int b[], int size){if (size == 1) // base casereturn b [0];else // recursive stepreturn b [size-1]+ whatIsThis (b, size - 1);} // end func±on whatIsThis
Attachments:
-----------