Question: In C++ #include using namespace std; //Implement the function below. bool is_fibonacci_array(int*,int); //Param 1: pointer to the beginning of an array of integers //Param 2:

In C++In C++ #include using namespace std; //Implement the function below. bool is_fibonacci_array(int*,int);

#include using namespace std; //Implement the function below. bool is_fibonacci_array(int*,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 0 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 main(){ //this is a Fibonacci array int a[5]={317811,28657,75025,3,8}; //this is NOT a Fibonacci array int b[3]={0,1,4}; int flag=is_fibonacci_array(a,5); //should print "Is a Fibonacci array." if (flag) cout  

Implement the function is fibonacci.array that takes an array of inte- gers 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

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!