Question: #include using namespace std; void computeSubtotals ( int * first , int * last , int n ) { / / WRITE YOUR CODE HERE

#include
using namespace std;
void computeSubtotals(int *first, int *last, int n){
// WRITE YOUR CODE HERE
}
//FREEZE CODE BEGIN
int main(){
int size, skipCount;
cin >> skipCount; //get skipCount value from user
cin >> size; //get size of the array from user
int numbers[size]; //declare the array to hold the values
for(int i=0; i> numbers[i]; //get values from user
}
computeSubtotals(numbers, numbers+(size-1), skipCount);
}
//FREEZE CODE ENDCompute subtotals using pointers
Compute subtotals when a skipCount value is given
Color coding is given to help understand how the answer is arrived.
Contents of given array:
When skipCount is 1, expected result : 36
When skipCount is 2, expected result : 1620
When skipCount is 3, expected result : 12,159
When skipCount is 4, expected result: 6,8,10,12
When skipCount is 5, expected result : 7,9,11,4,5
When skipCount is 6, expected result: 8,10,3,4,5,6
When skipCount is 7, expected result: 9,2,3,4,5,6,7
When skipCount is 8, expected result: 1,2,3,4,5,6,7,8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!