Write a Fibonacci function then takes an input from the user in main program and pass to function which prints Fibonacci series up to this number.
Hints:
Enter the value up to which you want to print the series : 5 0 1 1 2 3 5
Write a Fibonacci function in C++?
I bet you're in CS 1a? :)
That was my first programming assignment in college. I'd post a sample, but the answer above me listed a good site to get some source from. Good luck!
Reply:Hi,
The Fibonacci function defines a series of recurring numbers, so the function you are trying to solve should be translated into a logical statement (I normally use it in Java, but its too complicated to be explained here), similar to the mathematical formula of the Fibonacci Series....
Look it up at
http://en.wikipedia.org/wiki/Fibonacci_n...
Just read the formulas carefully, and that should help you out.
Hope I could help,
TK
PS.: By the way, if all you need is the prepared code, look up www.planetsourcecode.com , you'll probably find the class/function you need there... All you have to do is download it.
imperial
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment