Docsity

algorithm and flowchart solving, Schemes and Mind Maps of Business Informatics

Partial preview of the text

Download algorithm and flowchart solving and more Schemes and Mind Maps Business Informatics in PDF only on Docsity!

Algorithms &

Problems Solving

Chapter(2): Flow Chart

Dr. Mohamed Abdelsalam & Dr. Engi Yehia

Business Informatics & Digital Transformation Program

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 •The “A” connector indicates that the second flowchart segment begins where the first segment ends.

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.