Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm trying make Flowchart for function calculate a number in the Fibonacci Series. But It looks like not right. I don't how draw the recursive function. Please help me how to fix it.

My flowchart: DIA

PNG

This is my code:

#include <iostream>
using namespace std;

long long Fibonacci(int input);

int main()
{
    cout << "Input Fibonacci Index number: ";
    int Index = 0;
    cin >> Index;
    cout << Fibonacci(i) << endl;
    return 0;

}
long long Fibonacci(int input)
{
    if (input < 2)
        return input;
    else
    {
        return Fibonacci(input - 1) + Fibonacci(input - 2);
    }
}
share|improve this question
    
Is the call to fibonacci() not just a process/function symbol - no need for a special "I'm recursive function" symbol? –  Andrew Jan 13 '13 at 11:37
    
PS: I appreciate that the formatting here may not be your fault, but please be consistent on your use of braces and indentation - eg your for loop is not indented, some { opening braces are trailing others not (etc) –  Andrew Jan 13 '13 at 11:40
2  
Why are you trying to make a flowchart? We used those when we programmed in assembly language. They don't help when programming in any higher level language. –  kevin cline Jul 31 '13 at 2:55
1  
FYI, the runtime performance of the recursive Fibonacci implementation is beyond awful. –  whatsisname Jul 31 '13 at 3:25
1  
There are two kinds of flowcharts: (1) control-flow chart, which is the traditional understanding, and (2) value-dependency chart, which is sometimes called dataflow diagram. The computation of Fibonacci numbers is a often-mentioned example in which the two approaches would predict a different order of complexity given the chart. –  rwong Jul 31 '13 at 7:38
show 3 more comments

2 Answers 2

We should create flow chart before writing code to depict the flow. It should be simple enough to understand and has to be language agnositic. Here is flowchart that I created for fibonacci series.

enter image description here

share|improve this answer
add comment

The flowchart you have published is correct. You don't need to change anything. Only one comment: these dotted lines are really excessive, they are merely additional explanation, and it seems to me that it is because of them that you thought you have problems.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.