Presentation is loading. Please wait.

Presentation is loading. Please wait.

Flowcharts Remember that a solution to a problem is called an algorithm. Algorithms are often a series of steps required to solve the problem. A flowchart.

Similar presentations


Presentation on theme: "Flowcharts Remember that a solution to a problem is called an algorithm. Algorithms are often a series of steps required to solve the problem. A flowchart."— Presentation transcript:

1 Flowcharts Remember that a solution to a problem is called an algorithm. Algorithms are often a series of steps required to solve the problem. A flowchart is a graphical representation of an algorithm. Each step in the algorithm is represented by a different symbol

2

3 Flowchart Symbols Used to indicate a predefined or user-defined function is called

4 Sequential Structure Flowchart Example
Start Sequential Structure Flowchart Example Input NumOne Input NumTwo Create a program that will allow the user to input 3 integers and have the sum calculated and outputted. Input NumThree Calculate total of 3 numbers Output the total Stop

5 Flowchart Example #1 – while loop
Looping Structure Flowchart Example #1 – while loop Start Create a program that will have the user input a name and have it outputted until the user wishes to finish. While: False Stop Input continue? True Input a name Output a name

6 Flowchart Example #2 - for loop
Looping Structure Flowchart Example #2 - for loop Start Initialize total to 0 Initialize i to 0 Create a program that will allow the user to input 10 integers and have the sum calculated and outputted. Use a loop for this program. If i=10 Increment i Output total Yes Input a number No Add number to total Stop

7 Selective Structure Flowchart #1 - Binary Selection Structure
Create a program that will allow the user to input their age. If they are over 16, output they can drive, otherwise output they can’t drive. Start Input age if age >=16 Output “Can’t” False True Output “Drive” Stop

8 Selective Structure Flowchart #2 - Multiple Selection Structure
Create a program that will allow the user to input the number of widgets they sold. The program will output their level based on the following scale: Over 500, they are in the “Gold Club” Over 300, they are in the “Silver Club” Over 100, they are in the “Bronze Club” Not over 100, they are in the “Get a New Job Club”

9 Selection Structure (cont.)
Selective Structure Flowchart #2 Multiple Selection Structure (cont.) Start Input sales If sales >500 If sales >300 False True Output “Gold” Output “Silver” True If sales>100 False Stop Output “Bronze” True Output “New Job” False

10 Flowchart for a Program Using Predefined Functions
Start Flowchart for a Program Using Predefined Functions Input a string Count Characters In string Count spaces in string Create a program that will allow the user to input a string of more than one word. It will calculate and output the average number of characters in the words. Add 1 to number of spaces Calculate average number of characters in the words Output average number of words Stop

11 Flowchart Assignment Draw a flowchart for each of the
following problems Sequential #4 Selective #1, #3, #6 Repetitive #1b, #3b, #7 Functions #5, #6 Files #2


Download ppt "Flowcharts Remember that a solution to a problem is called an algorithm. Algorithms are often a series of steps required to solve the problem. A flowchart."

Similar presentations


Ads by Google