Question: 2.use c++ to Modify the question 1 by making the FibonacciNumber() function to store the outcome in the shared location using promise object and insert

2.use c++ to Modify the question 1 by making the FibonacciNumber() function to store the outcome in the shared location using promise object and insert the Fibonacci number in the vector inside the main function by retrieving it using future object.Analyze the output and see if there is anything still missing? Explain your answer.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

so here is my output code form the first question, can you help me for the second question, thank you

#include

using namespace std;

void fibonacciInt(){

cout<<"Fibonacci series with datatype as Int : ";

int t1 = 0, t2 = 1, nextTerm = 0, n,count=0;

cout << "Fibonacci Series: " << t1 << ", " << t2 << ", ";

nextTerm = t1 + t2;

while(nextTerm >=0)

{

cout << nextTerm << ", ";

t1 = t2;

t2 = nextTerm;

nextTerm = t1 + t2;

count++;

}

cout<<" Number of Fibonacci numbers that fit in type int are: "<

return;

}

void fibonacciLong(){

cout<<"Fibonacci series with datatype as Long : ";

long t1 = 0, t2 = 1, nextTerm = 0, n,count=0;

cout << "Fibonacci Series: " << t1 << ", " << t2 << ", ";

nextTerm = t1 + t2;

while(nextTerm >=0)

{

cout << nextTerm << ", ";

t1 = t2;

t2 = nextTerm;

nextTerm = t1 + t2;

count++;

}

cout<<" Number of Fibonacci numbers that fit in type long are: "<

return;

}

void fibonacciLongLong(){

cout<<"Fibonacci series with datatype as Long Long : ";

long long t1 = 0, t2 = 1, nextTerm = 0, n,count=0;

cout << "Fibonacci Series: " << t1 << ", " << t2 << ", ";

nextTerm = t1 + t2;

while(nextTerm >=0)

{

cout << nextTerm << ", ";

t1 = t2;

t2 = nextTerm;

nextTerm = t1 + t2;

count++;

}

cout<<" Number of Fibonacci numbers that fit in type long long are: "<

return;

}

int main() //main function

{

fibonacciInt();

fibonacciLong();

fibonacciLongLong();

return 0;

}

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!