Question: C++ - Implement the Function is_Fibonacci_array that takes an array of integers and its size as input. the goal of the function is to return

C++ - Implement the Function is_Fibonacci_array that takes an array of integers and its size as input. the goal of the function is to return true if every element in the array is a Fibonacci number, false otherwise. You do not need to change the main function. The function should work for ANY FIBONACCI NUMBER NOT JUST THE ONES IN THE MAIN FUNCTION.

HERE IS THE CODE

C++ - Implement the Function is_Fibonacci_array that takes an array of integers

#include using namespace std; //Implement the function below bool is_fibonacci_array(int*,int); bool is_fibonacci_number(int); //Param 1: pointer to the beginning of an array of integers //Param 2: size of that array //Returns: true, is every element in the input array is a Fibonacci number //(the order of the numbers in the array need not be ordered //as per the Fibonacci sequence) //false, otherwise //A Fibonacci sequence is generated as follows. /The first two numbers in the sequence are and 1 //The following numbers in the sequence are calculated by adding //the previous two numbers in the sequence. Thus the third number in the //sequence would be 1 (i.e., 0+1), the fourth being 2 (i.e., 1+1), the //fifth being 3 (i.e., 1+2), and so on, giving the following sequence: //0, 1, 1, 2, 3, 5, 8, 13, 21, 34, etc int mainO1 int a [5] 1317811,28657,75025,3,8; int b[31-0,1,4; int flag-isfibonacci_array(a,5); //should print "Is a Fibonacci array." if (flag) cout

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!