









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










introduction The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm. Flowchart is a graphical or symbolic representation of an algorithm. It is the diagrammatic representation of the step-by- step solution to a given problem.
Basic Flowchart Symbols Terminals represented by rounded rectangles indicate a starting or ending point START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read PayRate Multiply Hours by PayRate. Store result in GrossPay. Display GrossPay END Terminal START END Terminal
Basic Flowchart Symbols Input/Output Operations represented by parallelograms indicate an input or output operation START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read PayRate Multiply Hours by PayRate. Store result in GrossPay. Display GrossPay END Display message “How many hours did you work?” Read Hours Input/Output Operation
Four Flowchart Structures Sequence Decision Repetition
Sequence Structure A series of actions are performed in sequence The pay-calculating example was a sequence flowchart.
Decision Structure The flowchart segment below shows a decision structure with only one action to perform. It is expressed as an if statement in C++ code. if (x < y) a = x * 2; Flowchart C++ Code NO YES x < y? Calculate a as x times 2.
Repetition Structure The flowchart segment below shows a repetition structure expressed in C++ as a while loop. while (x < y) x++; Flowchart C++ Code x < y? (^) Add 1 to x YES
Controlling a Repetition Structure ANSWER: By adding an action within the repetition that changes the value of x. x < y? (^) Display x (^) Add 1 to x YES
Connectors A START^ A END
Draw flowchart to read 2 numbers from user then calculate summation of them and print it.
Draw flowchart to read 2 numbers from user then print the maximum of them.