Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment is shown below the pic. I have the function to calculate the Fibonacc

ID: 3667012 • Letter: A

Question

Assignment is shown below the pic. I have the function to calculate the Fibonacci numbers. But I am having trouble storing this program to an array. I'm stuck in this step please help. #inelude using namespace std; void ShowvWalues (int [1, int); I/ function prototype int main() const int ARRAY_SIZE 8; int numbers(ARRAY-SIZE] {2,4,6,8,10,12, 14,16); = Showalues(numbers, ARRAY_SIZE); //pass the array into the function by its name return e; //Now for the fuunction void ShowWalues(int nums[], int size) /accept the array into the function as "nums" Note: nums is not an array but nums can accept the address of an array That is, an array is passed into a function by reference to an address What would happen if we passed the WHOLE array into a function, rather than just the address of the beginning of the array? int i e; while (i

Explanation / Answer

It is simple.

void fibonacci() {

// Declare a variable with the array capacity

const int ARRAY_SIZE = 100;

// Declare an array of the same size with elements initialized to zero

int arr[ARRAY_SIZE] = {0};

// Then you can set each element like this:

arr[0] = 0;

arr[1] = 1;

arr[2] = 1;

arr[2] = 2;

// .. upto arr[99]

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote