Post: [C++] Fibanocci Term Calculator w/ Recursion
03-14-2011, 01:10 AM #1
Ritztro
I am a Game Developer
(adsbygoogle = window.adsbygoogle || []).push({}); WARNING! When I tried to use this on the number 50, my computers cpu got up to 140 so be carefull with high numbers. (Someone with cooling fans, try running 1,000 and let your computer sit for a liek half an hour or so and see what happens)

Here is my fibanocci series term calculator:
    
#include <iostream>

using namespace std;

long long Fibanocci(int nth);

int main()
{
long long * piNum = new long long;
cout << "Please enter what term you would like from the Fibanocci series (warnign! High numeber (even 50) can overheat your computer): ";
cin >> *piNum;
cout << "\nYour value is: " << Fibanocci(*piNum) << endl;
cin.get();


return 0;
}

long long Fibanocci(int nth)
{
long long temp = 0;
if (nth < 4) return 1;
temp = (Fibanocci(nth-2) + Fibanocci(nth -1));
return temp;
}
03-19-2011, 06:55 AM #11
XDev
Banned
thanks man your amazing

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo