C语言 如何在流程图中表示函数?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4490297/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 07:23:23  来源:igfitidea点击:

How to represent functions in flowchart?

cflowchart

提问by asedra_le

I define some function in my Ansi C Program (simple program). I don't known how to represent a function in flowchart. Anybody can help me?

我在我的 Ansi C 程序(简单程序)中定义了一些函数。我不知道如何在流程图中表示函数。任何人都可以帮助我吗?

采纳答案by bta

On a flowchart, a function can be anything: a state, an action that occurs while transitioning betwwen states, etc. It all depends on how you have your flowchart organized. I would recommend building your flowchart normally, then go back and add a function name to the description of anything that is implemented by a function.

在流程图上,函数可以是任何东西:状态、在状态之间转换时发生的动作等。这完全取决于您如何组织流程图。我建议您正常构建流程图,然后返回并在函数实现的任何内容的描述中添加函数名称。

回答by RC.

In my opinion, a flowchart is more of a functional description of your algorithm and not where you would "define" a function in the sense of your program. Yes, a functional aspect represented in your flowchart may directly map to a single function in your C program, but it may be that multiple functions or multiple threads are used to accomplish it as well. The flowchart isn't where you would describe these.

在我看来,流程图更像是对算法的功能描述,而不是在程序意义上“定义”函数的位置。是的,流程图中表示的功能方面可能直接映射到 C 程序中的单个功能,但也可能使用多个功能或多个线程来完成它。流程图不是您描述这些的地方。

In short, the flowchart is not where you should be "defining" functions for your C program. It should be a high-level representation of functional aspects of your program, not the implementation of it.

简而言之,流程图不是您应该为 C 程序“定义”函数的地方。它应该是程序功能方面的高级表示,而不是它的实现。

回答by Stepan Mitkin

Here is a tutorial on writing C functions using DRAKON charts (DRAKON charts are very similar to flowcharts):

这是使用 DRAKON 图表编写 C 函数的教程(DRAKON 图表与流程图非常相似):

http://drakon-editor.sourceforge.net/cpp/c.html

http://drakon-editor.sourceforge.net/cpp/c.html

回答by samis

I had a similar question, Flowcharting a Get-ter, which was answered with:

我有一个类似的问题Flowcharting a Get-ter,回答如下:

NOTE: Please don't upvote this answer but instead the original within the above link.

注意:请不要点赞这个答案,而是点赞上面链接中的原点。

Flowcharts represent flow of control, not flow of information. Flowcharting formally captures steps and the linkages between them that describe the transfer of the flow of control that are often based on decisions: in particular, conditional branches and loops.

Flow of control is about what is done or happens next, and (sadly) not about the required data to perform that step.

According to Wikipedia, there are some extensions for the flow of data; however, they are basically limited to documents and files.

Generally speaking, state is poorly represented in flowcharting; there is virtually no notion of data, variables, scopes, lifetimes, or types. So, data (and metadata about that data, such as allowed or expected types) is mostly documented informally with human language description in the text within individual steps of the flowchart.

Input & Output in flowcharting is meant to indicate communication with another independent and top-level process (even if it is just a later running copy of one's self). As such this communication is about reading/writing to disc or to a network.

A getter does not qualify as input or output, which is to say communication with another independent process, so I think that is out. I don't think they even had getter's when flowcharting was first applied to software design (circa 1950).

You might look in to UML. – Erik Eidt Dec 12 '16 at 16:51

流程图代表控制流,而不是信息流。流程图正式捕获描述控制流转移的步骤和它们之间的联系,这些控制流通常基于决策:特别是条件分支和循环。

控制流是关于下一步做什么或发生什么,并且(遗憾的是)与执行该步骤所需的数据无关。

根据维基百科,数据流有一些扩展;但是,它们基本上仅限于文档和文件。

一般来说,状态在流程图中表现不佳;几乎没有数据、变量、范围、生命周期或类型的概念。因此,数据(以及关于该数据的元数据,例如允许的或预期的类型)主要是在流程图的各个步骤中用人类语言描述非正式地记录在文本中。

流程图中的输入和输出旨在表示与另一个独立的顶级进程的通信(即使它只是自己的一个稍后运行的副本)。因此,这种通信是关于读取/写入磁盘或网络。

一个 getter 不具备输入或输出的资格,也就是说与另一个独立进程的通信,所以我认为这是出局了。我认为当流程图首次应用于软件设计时(大约 1950 年),他们甚至没有 getter。

您可能会查看 UML。– Erik Eidt 2016 年 12 月 12 日 16:51

回答by Sudantha

There is no direct symbol.. you can create your function with the basic input /output/process symbols

没有直接的符号..你可以用基本的输入/输出/处理符号创建你的函数