Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use C++ 2.(Fibonacci Series) (50 points) Modify a program generating a Fibonacci series (Program 3 from the Homework1) in the following way. The Fibonacci series

Use C++ image text in transcribed
2.(Fibonacci Series) (50 points) Modify a program generating a Fibonacci series (Program 3 from the Homework1) in the following way. The Fibonacci series shall be generated in the function int EibGsp(int ptrl, int ptr2) where ptrl is a pointer to the 1t member of the series and ptr2 is a pointer to the 2nd member of the series. A series generated in the function shall be located in the dynamical array and return a pointer to this array to a calling program. The (0h) element of this array shall be reserved for the number of the series members generated, the series members shall be located starting from the (1) element of the resulting array The series members shall be generated until the ratio of adjacent values converges to the golden section within 0.001, which means that the process should be stopped when the following condition holds s0.001 where xi,x2,K,.-4-2,&q,,,, is a Fibonacci series. Test this function by writing a main function which shall a) prompt the user to enter two first members of the series and accept them; b) pass pointers to the members entered to the EibSso function; c accept a returned dynamical array from the EibGso function; d) display the number of the series members generated (0h element of the array) and the series members. (Hint: First use a while loop to calculate how many elements a Fibonacci series should contain based on the values of first two elements and the criterion above. Then create a dynamical array containing exactly that number of elements, which was found in the while loop and use a for loop to finally generate a Fibonacci series and put its elements in the dynamical array.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago