Assignment 5A: Fibonacci Sequence. You may have learned about Fibonacci Sequences in high school or prior classes. To briefly summarize, it is a sequence that is created when you repeatedly add the two prior numbers in the sequence together. Here is an example of the first few numbers in the sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21... In CSE 1322L, we teach students how to create this sequence using an advanced concept called recursion. In this class however, we'll use arrays and loops. Your task is to do the following: Prompt the user to enter the length of the Fibonacci Sequence they want to make o Validate that the number is greater than 0, and keep asking them until it is Use that number to initialize an empty array o C++ Students: Watch the video posted on the FYE website or D2L to learn how to do this in your language – it's a little different from the Java and C# approach Initialize index 0 of the array to 0, and index 1 of the array to 1. Using a looping structure, fill the array with the correct Fibonacci sequence values Once the array is full, use another looping structure to print the sequence from the array Note: You must store the sequence in the array, and then print it in a separate loop from the one that created it. You can not print the values in the same loop where you create and store them in the array.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

Language to be in C++

Sample Output #1:
[Fibonacci Sequence Generator]
How long should the Fibonacci Sequence be?: -15
Sequences must be larger than 0!
How long should the Fibonacci Sequence be?: 5
Okay, here's your sequence:
0, 1, 1, 2, з
Sample Output #2:
[Fibonacci Sequence Generator]
How long should the Fibonacci Sequence be?: 12
Okay, here's your sequence:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89
Transcribed Image Text:Sample Output #1: [Fibonacci Sequence Generator] How long should the Fibonacci Sequence be?: -15 Sequences must be larger than 0! How long should the Fibonacci Sequence be?: 5 Okay, here's your sequence: 0, 1, 1, 2, з Sample Output #2: [Fibonacci Sequence Generator] How long should the Fibonacci Sequence be?: 12 Okay, here's your sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89
Assignment 5A: Fibonacci Sequence. You may have learned about Fibonacci
Sequences in high school or prior classes. To briefly summarize, it is a sequence that is
created when you repeatedly add the two prior numbers in the sequence together. Here
is an example of the first few numbers in the sequence:
0, 1, 1, 2, 3, 5, 8, 13, 21...
In CSE 1322L, we teach students how to create this sequence using an advanced
concept called recursion. In this class however, we'll use arrays and loops.
Your task is to do the following:
• Prompt the user to enter the length of the Fibonacci Sequence they want to make
Validate that the number is greater than 0, and keep asking them until it is
Use that number to initialize an empty array
C++ Students: Watch the video posted on the FYE website or D2L to learn
how to do this in your language – it's a little different from the Java and C#
approach
Initialize index 0 of the array to 0, and index 1 of the array to 1.
Using a looping structure, fill the array with the correct Fibonacci sequence
values
Once the array is full, use another looping structure to print the sequence from
the array
Note: You must store the sequence in the array, and then print it in a separate loop from the one
that created it. You can not print the values in the same loop where you create and store them in the
array.
Transcribed Image Text:Assignment 5A: Fibonacci Sequence. You may have learned about Fibonacci Sequences in high school or prior classes. To briefly summarize, it is a sequence that is created when you repeatedly add the two prior numbers in the sequence together. Here is an example of the first few numbers in the sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21... In CSE 1322L, we teach students how to create this sequence using an advanced concept called recursion. In this class however, we'll use arrays and loops. Your task is to do the following: • Prompt the user to enter the length of the Fibonacci Sequence they want to make Validate that the number is greater than 0, and keep asking them until it is Use that number to initialize an empty array C++ Students: Watch the video posted on the FYE website or D2L to learn how to do this in your language – it's a little different from the Java and C# approach Initialize index 0 of the array to 0, and index 1 of the array to 1. Using a looping structure, fill the array with the correct Fibonacci sequence values Once the array is full, use another looping structure to print the sequence from the array Note: You must store the sequence in the array, and then print it in a separate loop from the one that created it. You can not print the values in the same loop where you create and store them in the array.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning