I have to create a flowchart to a C# programm and I am not very familiar with it. My problem is that I do not know if one should represent variables initialization in a flowchart and if so how should I do it. Second problem is that I am not sure about the correctness of my for loop.

Here is the flowchart I created tot a part of the programm. It would be very nice if you can tell me if that is correct and if not what should I correct.

Thank you! enter image description here

closed as unclear what you're asking by gnat, BЈовић, kevin cline, ChrisF Jan 19 '14 at 22:06

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


Flowcharts are to capture solution logic in a stable/readable form. If this is sufficient for your audience, that is all that matters. Is this for yourself or a different audience? What are the audiences expectations? Is there an established standard that they are expecting?

If it is important to your logic that the variables be initialized, then add a preparation symbol (a wide hexagon) with the initializations. If the variable initializations aren't useful, then ignore them. In this case, it does not look like credit is being used as an accumulator, so it would not be important to initialize it.

Your loop looks fine, but I believe you should have a line from the top loop structure to the bottom. You could also move the exit condition to the bottom loop symbol.

  • Hey, thank you! What do yu think about the for loop, expecially this part--> "i=0; i< max; i++" Do you think I should describe it in words or just use code? – CMS Jan 8 '14 at 16:05
  • It depends on your audience, and intent. If it is important to your algorithm that the loop is a for loop, the having the structure you list makes sense. If the loop type doesn't matter, then just put in your condition in words. You don't have to explicitly use the loop construct, you can make do with a conditional (diamond shape) at the end with your sentinel. Remember, the flow chart is to capture the solution, not write the code. Your implementation of the solution into code can (and probably will) be different. – Larry Smithmier Jan 8 '14 at 16:19

I think what you've done is very nice and easy to understand. Whether or not you include variable initialization largely depend on what level of abstraction you're trying to achieve. However, I think if you're at the point of needing to show variable initializations, you might as well just write the code and present that instead. Code itself is practically just a flow chart without lines. And so I don't personally think that variable initialization is appropriate for a flow chart.

  • hey thanks, what about the for loop? – CMS Jan 8 '14 at 16:06
  • I would describe the for loop in words, personally. – Alex Dresko Jan 8 '14 at 17:41

About the loop: the variable i is an implementation detail. You don't really care that a variable named i goes from 0 to max-1 - you only care that the loop is being executed max times. I think it should be replaced with Repeat max times or something similar.

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