Hello all, I am having tremendous problems writing this program. I know that I should be able to write this proram in 15 lines (maybe even less) but I am having trouble finding the correct method to write it. I've been trying to write it for a few days now and am frustrated because I know that it is a simple mistake that I am making.
I am trying to write a program that sums the elements of an array.
It's supposed to take 3 arguments that I believe I entered correctly
m: start position of array (1<=m<=10
n:end position of array (1<=n<=10 and m<=n)
Basically I am trying to get the program to add the elements (m through n) using recursion.
Another part of this is that I have to use the pointer but I'll figure that one out later
Just please let me know if I am way off because I havent had too many problems with C++ up until now. Should I start from scratch?? Is my sum function all wrong??
In advance, Thank you for any help you can provide
int sum(int); // function prototype
cout << "Please enter the starting position: ";
cin >> m;
cout<< "Please enter the end position: ";
// end main
int sum ()
if ( 1 <= m<=10 && 1<=n<10 && m<=n)
// recursive step
} // end function