Top Banner
Flowcharts • So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers
42

Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

Dec 17, 2015

Download

Documents

Jayson Carter
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

Flowcharts

• So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers

Page 2: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

Page 3: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

Read in A, B and C

Page 4: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?

Read in A, B and C

Page 5: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?

Read in A, B and C

YesA>C?

Page 6: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?No

Read in A, B and C

YesA>C? B>C?

Page 7: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?No

Read in A, B and C

YesA>C? B>C?

Biggest = C

NoNo

Page 8: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?No

Read in A, B and C

YesA>C? B>C?

Biggest = A Biggest = C

Yes

NoNo

Page 9: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?No

Read in A, B and C

YesA>C? B>C?

Biggest = A Biggest = C Biggest = B

Yes Yes

NoNo

Page 10: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?

No

Read in A, B and C

YesA>C? B>C?

Biggest = A Biggest = C Biggest = B

Yes Yes

No

No

Page 11: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.
Page 12: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

A>B?

Page 13: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

A>B?Yes

B<C?

Page 14: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

A>B?Yes

B<C? A<C?No

Page 15: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

A>B?

No

YesB<C? A<C?

No

No

Page 16: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

A>B?

No

YesB<C? A<C?

Smallest = C

No

No

Page 17: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

A>B?

No

YesB<C? A<C?

Smallest = A Smallest = C

Yes

No

No

Page 18: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

A>B?

No

YesB<C? A<C?

Smallest = A Smallest = C Smallest = B

Yes Yes

No

No

Page 19: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

A>B?

No

YesB<C? A<C?

Smallest = A Smallest = C Smallest = B

Yes Yes

No

No

Page 20: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

A>B?

No

YesB<C? A<C?

Smallest = A Smallest = C Smallest = B

Yes Yes

No

No

Print Smallest + Biggest

Page 21: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

A>B?

No

YesB<C? A<C?

Smallest = A Smallest = C Smallest = B

Yes Yes

No

No

Print Smallest + Biggest

END

Page 22: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

Flowcharts

• So let’s say we want to express the following algorithm to print out the biggest of four numbers

Page 23: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

Page 24: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

Read in A, B, C and D

Page 25: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?

Read in A, B, C and D

Page 26: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?Yes

Read in A, B, C and D

X = A

Page 27: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?NoYes

Read in A, B, C and D

X = A X = B

Page 28: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?NoYes

Read in A, B, C and D

X = A X = B

Page 29: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?NoYes

Read in A, B, C and D

X = A X = B

C>D?

Page 30: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?NoYes

Read in A, B, C and D

X = A X = B

C>D?Yes

Y = C

Page 31: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?NoYes

Read in A, B, C and D

X = A X = B

C>D?NoYes

Y = C Y = D

Page 32: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?NoYes

Read in A, B, C and D

X = A X = B

C>D?NoYes

Y = C Y = D

Page 33: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

START

A>B?NoYes

Read in A, B, C and D

X = A X = B

C>D?NoYes

Y = C Y = D

Page 34: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.
Page 35: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

X>Y?

Page 36: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

X>Y?Yes

Print X

Page 37: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

X>Y?NoYes

Print X Print Y

Page 38: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

X>Y?NoYes

Print X Print Y

Page 39: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

X>Y?NoYes

Print X Print Y

END

Page 40: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

Symbols

Page 41: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

Symbols

Page 42: Flowcharts So let’s say we want to express the following algorithm to print out the sum of the biggest and smallest of three numbers.

Terminal

Input/Output Operation

Process

Decision

Connector

Module

Symbols