Flowchart (รูปแบบการเขียนผังงาน)
1.รูปแบบผังงานตามลำดับ
2.รูปแบบผังงานทางเลือก
ลักษณะของแบบสองทางเลือก (double selection) จะประกอบด้วย 1 เงื่อนไข และ 2 กิจกรรม หลักการตรวจสอบเงื่อนไข ถ้าเงื่อนไขเป็นจริง จะทำกิจกรรมที่ 1 แล้วออกจากโครงสร้าง แต่ถ้าเงื่อนไขเป็นเท็จ จะทำกิจกรรมที่ 2 แล้วออกจากโครงสร้าง และทำตามลำดับต่อไปเรื่อย ๆ จนถึงจุดสุดท้ายของผังงาน
3.ผังงานแบบวนซ้ำ
เป็นการนำคำสั่งมาทำงานซ้ำหลายๆ รอบ จะทำงานกี่รอบขึ้นอยู่กับเงื่อนไขที่ผู้เขียนโปรแกรมกำหนดไว้ ซึ่งอาจจะเป็นการกำหนดจำนวนรอบที่แน่นอน เช่น ตั้งใจว่าจะวิ่งรอบสนาม 3 รอบ คือรู้แน่นอนว่าจะทำงานกี่รอบ หรือแบบจำนวนรอบไม่แน่นอน เช่น ตั้งใจว่าจะวิ่งรอบสนามไปเรื่อยๆ เหนื่อยเมื่อไหร่จึงจะหยุดวิ่ง คือไม่แน่ชัดว่าจะทำงานกี่รอบ
1.Sequence
The flowchart above demonstrates a sequence of steps. The reader would start at the Start shape and follow the arrows from one rectangle to the other, finishing at the End shape. A sequence is the simplest flowcharting construction. You do each step in order.
2.Decision
This structure allows you to repeat a task over and over. The red chart above on the left does the task and repeats doing the task until the condition is true. The green chart on the right checks the condition first and does the task while the condition is true. It is not important that you remember whether the loop is a "Do While" or "Repeat Until" loop, only that you can check the condition at the start of the loop or at the end. You can also have the conditions reversed and your loop is still a structured design loop. A slight variation of the above is the "For each...do the following" loop shown below.
3.Loop
This structure is called a decision, "If Then.. Else" or a conditional. A question is asked in the decision shape. Depending on the answer the control follows either of two paths. In the chart above, if the temperature is going to be less than freezing (32 degrees Fahrenheit) the tomatoes should be covered. Most RFFlow stencils include the words "Yes" and "No" so you can just drag them onto your chart. "True" and "False" are also included in most of the flowcharting stencils.
No comments:
Post a Comment