Recursion and Array

I am working on a project and it's main focus is to test my understanding of recursion. The second part, of three, asks to create a function which passes two parameters one parameter being an int arr[] and the second being an integer that indicates the number of elements within the array. The function is supposed to add the elements of the array, oh and my instructor gave me the hint to use the elements as the subscripts *if that helps*. Here is my code for the project so far. (I'm not asking for someone to actually do the work for me, I just think maybe someone could give me some direction.)

//Programmer: S. Lipke
//Purpose:

#include <iostream>
using namespace std;

//Function Prototypes
void sign(int);
//int intArray(int, int);

int main()
{
int n;
int intArray[] = {1,2,3,4,5,6,7,8,9,10};

//promt for sign function
cout << "please enter the value for n: ";
cin >> n;
sign(n);
cout << endl;

//promt for intArray function
cout << "the added values of the array: ";
//intArray();

system("pause");
return 0;

}

int sum(int testArray[], int element) //*here is where i need help*
{ //thanks for any help
if(element > 0)
{

//cout << element;
}
return element + element++;
}

void sign(int n)
{
if(n-- > 0)
{
cout << "No Parking\n";
sign(n);
}
}
Recursion means the function calls itself. Currently, you don't have that anywhere in your code. That's the first place to start.
Topic archived. No new replies allowed.