Markdown绘制流程图的方法

来源:互联网 发布:c语言计算圆面积 编辑:程序博客网 时间:2024/04/28 20:55

Markdown绘制流程图的方法

日期:2015/08/13
作者:Z.K.

用Markdown绘制流程图十分简单方便,下面以几个例子来介绍其使用方法

Example1闰年判断

在编辑器中输入如下代码,

```flowst=>start: Starti=>inputoutput: 输入年份ncond1=>condition: n能否被4整除?cond2=>condition: n能否被100整除?cond3=>condition: n能否被400整除?o1=>inputoutput: 输出非闰年o2=>inputoutput: 输出非闰年o3=>inputoutput: 输出闰年o4=>inputoutput: 输出闰年e=>endst->i->cond1cond1(no)->o1->econd1(yes)->cond2cond2(no)->o3->econd2(yes)->cond3cond3(yes)->o2->econd3(no)->o4->e```

即可得到下面的流程图,其中start表示开始,condition表示条件判断,inputoutput表示输入输出,end表示结束。注意声明时,冒号后面必须加空格,如:st=>start: Start

Created with Raphaël 2.1.0Start输入年份nn能否被4整除?n能否被100整除?n能否被400整除?输出非闰年End输出闰年输出闰年输出非闰年yesnoyesnoyesno

Example2子程序

在编辑器中插入代码

```flowst=>start: start:>http://www.baidu.comop1=>operation: 操作1cond1=>condition: YES or NO?sub=>subroutine: 子程序e=>endst->op1->cond1cond1(yes)->econd1(no)->sub(right)->op1  ```

如上所示,subroutine表示子程序,sub(right)可定义连接点的位置,同时st=>start: start:>http://www.baidu.com 还可以在方块上插入超链接。

Created with Raphaël 2.1.0http://www.baidu.comstarthttp://www.baidu.com操作1YES or NO?End子程序yesno

Example3

在编辑器中插入代码

```flowst=>start: Start|past:>http://www.baidu.come=>end:  Ende|future:>http://www.baidu.comop1=>operation:  My Operationop2=>operation:  Stuff|currentsub1=>subroutine:  My Subroutine|invalidcond=>condition:  Yes or No|approved:>http://www.google.comc2=>condition:  Good idea|rejectedio=>inputoutput:  catch something...|futurest->op1(right)->condcond(yes, right)->c2cond(no)->sub1(left)->op1c2(yes)->io->ec2(no)->op2->e  ```
Created with Raphaël 2.1.0http://www.baidu.comStarthttp://www.baidu.com My Operationhttp://www.google.com Yes or Nohttp://www.google.com Good idea catch something...http://www.baidu.com Endehttp://www.baidu.com Stuff My Subroutineyesnoyesno
1 0
原创粉丝点击