$29
Install Linux and C++ - Prog 0
CECS 325-01
You need to have Linux on your computer.
If you have a Windows machine, you can install WSL https://docs.microsoft.com/en-us/windows/wsl/install
If you have a Mac, you may be able to use the Terminal, or you may want to install Linux
After you install Linux on our machine, you need to install a C++ compiler. At the prompt (%>), try typing:
%> c++ anything.cpp
You will likely get an error message saying you do not have C++ install, and likely will receive a suggestion on how to acquire it.
Eventually you will have Linux and C++ installed – this is the first program you will write and run. This is the Fibonacci Sequence in C++
#include <iostream>
using namespace std;
// Fibo function
int fibo(int n)
{
if (n == 1 || n == 0)
return 1;
else
return fibo(n-1) + fibo(n-2); // recursion
}
int main()
{
for (int i = 1; i <= 20; i++)
cout << i << ":" << fibo(i)<<endl;
return 0;
}
We will go over this program in class so that you understand each and every line. Ny the way – you can use an online compiler to run this program to prove it works. I like www.onlinegdb.com
Submit the following to BeachBoard by the due date:
• fibo.cpp (C++ source code)
• Screenshot of the output