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

Program in C++ Task: Create the Fahrinacci sequence. This sequence is made by mu

ID: 3598927 • Letter: P

Question

Program in C++

Task: Create the Fahrinacci sequence. This sequence is made by multiplying the first number by 3 and subtracting the second number.

            Example: num1 = 4, num2 = 2

            Sequence: 4, 2, 10, -4, 38, etc.

Processing: Calculate the Fahrinacci sequence and store the numbers in a doubly linked list.

Menu:

Ask for the first 2 numbers of the sequence (assume they don’t match) and how many terms there should be in the sequence. Then create the sequence.

Print the sequence of numbers.

Check to see if a number is in the sequence of numbers and how many times it occurs.

Display the two numbers that were added to make all occurrence of a number in the sequence.

Display the two numbers in the sequence that will use a number to create them. Ask the user for the number. Only need to check for the first occurrence.

Delete all occurrences of a number from the sequence. (Some of the other options in the menu will no longer make sense.)

Exit.

Program is to be well documented both internally and externally.

Explanation / Answer

#include<iostream>
using namespace std;
int main()
{
int i,num, firstno, secondno, nextnum;
system("cls");
cout<<"Enter first number";
cin>>firstno;
cout<<"Enter second number";
cin>>secondno;
cout<<"Enter nubmer of terms for Fahrinacci Series: ";
cin>>num;
cout<<"Fahrinacci series are: ";
for(i=0; i<num; i++)
{
cout<<" "<<firstno;
nextnum = firstno*3 - secondno;
firstno = secondno;
secondno = nextnum;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote