78 452
Assignments Done
Successfully Done
In September 2019

Answer to Question #21406 in C++ for george

Question #21406
Create a thread that will use a runner function and from the thread function (e.g. runner) call the Fibonacci function to generate the Fibonacci series and store them in the array. Use the parameter supplied in the function runner in order to determine how many Fibonacci numbers must be generated.
Expert's answer

# include <iostream>
#include <vector>
using namespace std;
std::vector<int> fib_n(int n)
std::vector<int> dp(n + 1);
dp[1] = 1;
if (n<2) return dp;
dp[2] = 1;
if (n<3) return dp;
for (int i = 3; i <= n; i++)
dp[i] = dp[i - 1] + dp[i - 2];
return dp;
void print (vector<int> a){
for(int i=1;i<a.size();i++){
cout<<a[i]<<" ";

int main(){
setlocale( LC_ALL,"Russian" );
vector<int> c;
int n;
cout<<"Enter n : ";


return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions