+1 (208) 254-6996 [email protected]
  

I have a code, and I would like you to make three separate files in c++.

#include <iostream> using namespace std; int catalan(int n) { unsigned long int cat[n + 1]; cat[0] = cat[1] = 1; int i, j; for (i = 2; i <= n; i++) { cat[i] = 0; for (j = 0; j < i; j++) { cat[i] += cat[j] * cat[i – j – 1]; //calatlon number } } return cat[n]; } int fibonacci(int n) { if (n == 0) return 0; else if (n == 1) return 1; else return fibonacci(n – 1) + fibonacci(n – 2);//recursive calls } int main() { int option, n; do { cout << “\n1. Do Catalan numbers”; cout << “\n2. Do Fibonacci numbers (recursive)”; cout << “\n0. Quit”; cout << “\nEnter selection: “; cin >> option; switch (option) { case 1: cout << “\nEnter Catalan number to calculate: “; cin >> n; cout << “\nCatalan number at ” << n << ” is ” << catalan(n); break; case 2: cout << “\nEnter Fibonacci number to calculate: “; cin >> n; cout << “\nFibonacci number ” << n << ” is ” << fibonacci(n); break; case 0: break; default: cout << “\nInvaid option”; break; } } while (option != 0); return 0; }

Don't use plagiarized sources. Get Your Custom Essay on
3 Files: A Header File, Implementation File, And A Main
Just from $13/Page
Order Essay

Order your essay today and save 10% with the discount code ESSAYHELP