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)

int_array[]:integer array

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

Code:

#include <iostream.h>
int sum(int); // function prototype
int main()
{
int int_array[10]={1,2,3,4,5,6,7,8,9,10};
int m,n;
cout << "Please enter the starting position: ";
cin >> m;
cout<< "Please enter the end position: ";
cin>>n;
return 0;
// end main
}
int sum ()
{
if ( 1 <= m<=10 && 1<=n<10 && m<=n)
return int_array[m]+int_array[n];
// recursive step
else
return 1;
} // end function