You can just do something simple like this with loops which keeps going through the array (adding each element to the Sum) until it hits whatever limit you want to set.
1 2 3 4 5 6 7 8 9 10
int Array[] = {1,2,3,4,5,6,2};
int Limit = 7;
int Sum = 0;
for(int i = 0; i < Limit; i++)
{
Sum += Array[i];
}
cout << "The sum of the numbers is " << Sum << endl;
int Array[] = {1,2,3,4,5,6,2};
int Counter = 0;
int Limit = 7;
int Sum = 0;
while(Counter < Limit) // Keeps looping until Counter == Limit
{
Sum += Array[Counter];
Counter++; // Adds 1 to Counter
}
cout << "The sum of the numbers is " << Sum << endl;