Hello,
I was looking for some help on an assignment. I am taking a course in Data Sructures with C++ using STL
The assignment states:
Write a header file that contains a recursive method Fib with one parameter of type long and returns the Fibonacci value. remember to use long as a data type for the returned Fibonacci result by the the method fib because the number could be very large.
Write a c++ file that reads in a long number and returns the corresponding Fibonacci number. Remember to limit the number you read in to a value between 0 and 40.
I understand the formula on paper but using the header file in conjunction with the .cpp file and its implementation is confusing me. Please Help. Here is what I have so far.
CODE
//July 16,2007
//Assignment 3
//File Name: fibonacci.h
#include <iostream>
using namespace std;
class fib
{
public:
fib(long n = 0);
};
fib::fib(long n)
{
if (n < 0)
cout<<"Number must be in the range 0-40\n";
}
//July 16,2007
//Assignment 3
//File Name: fibonacci.cpp
#include <iostream>
#include "fibonacci.h"
using namespace std;
int main()
{
fib n;
cout<<"Enter a number between 0 and 40\n";
/*cin>>n;*/
cout<<"Fibonacci Number is: \n";
cin.get();
return 0;
}