fr n verkligt problem till datorprogram n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Från verkligt problem till Datorprogram? PowerPoint Presentation
Download Presentation
Från verkligt problem till Datorprogram?

Loading in 2 Seconds...

play fullscreen
1 / 25

Från verkligt problem till Datorprogram? - PowerPoint PPT Presentation


  • 114 Views
  • Uploaded on

Från verkligt problem till Datorprogram?. Du vet vad Du vill göra, men hur kommer man till ett färdigt C-program?. Morning routine. Get dressed. Eat breakfast. Go to school. Division. Time. Structure diagram. By 2IT Data students …. ”Morningwhile has gold in mouthd”. Morning routine.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Från verkligt problem till Datorprogram?' - elyse


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
fr n verkligt problem till datorprogram
Från verkligt problem till Datorprogram?

Du vet vad Du vill göra, men hur kommer man till ett färdigt C-program?

structure diagram

Morning routine

Get dressed

Eat breakfast

Go to school

Division

Time

Structure diagram

By 2IT Data students …

”Morningwhile has gold in mouthd”

sequence order in time

Morning routine

Get dressed

Eat breakfast

Go to school

Time

8:00 am

8:02 am

8:05 am

Sequence (order in time)

Sequence

Sequence parts

structure diagram1

Morning routine

Get dressed

Eat breakfast

Go to school

Find clothes

Put clothes on

Take from

Ask girlfriend

wash basket

where clothes are

Structure diagram

”Morningwhile has gold in mouthd”

Division

Time

selection

What colour on your socks?

If blue doesn’t exist,but pink does

If blue exists

Else

Blue

Pink

White

Selection

Selection

Selection parts

structure diagram2

Morning routine

Get dressed

Eat breakfast

Go to school

Find clothes

Put clothes on

Many glasses of beer

Take from

Ask girlfriend

One glassof beer

wash basket

where clothes are

Structure diagram

”Morningwhile has gold in mouthd”

Division

Time

iteration repetition

Drink beer (lightbeer)

Many glassesof beer

One beer

Iteration (repetition)

Iteration

As long as you’re thirsty

Iteration part

structure diagram3

Morning routine

Get dressed

Eat breakfast

Go to school

Find clothes

Put clothes on

Take a cab

Run

Many glasses of beer

Take from

Ask girlfriend

One glassof beer

One step

wash basket

where clothes are

Structure diagram

”Morningwhile has gold in mouthd”

Division

Time

flow chart

Morning route

Get dressed

ELSE

Search clothes

IF you find basket

Get from laundry

Ask girl/boyfriend

basket

Put on the clothes

Eat breakfast

Eat one pancake

WHILE pancakes <> 0

Go to school

IF money = 0

ELSE

Run

Take a cab

Move foot one step

WHILE distance to school <> 0

Flow chart

Flowcharts are onedimensional. They are used when you have to describe exactly how the code is processed.

The Structure diagram is easier to follow.

crossing

A

Crossing

Imagine driving in car B, just behind another car A.

You come to a crossing.

How will you know which direction it will chose?

Car A has to make a selection

B

crossing a selection of directions

Selection

Red signal

Green signal

STOP

DRIVE

Left blinker

No blinker

Right blinker

Drive left

Straight ahead

Drive right

Crossinga selection of directions

How can you see in which direction the car in

front of you will choose?

Crossing

marriage a selection

Young man´s

future choice

Marry girl

Marriage - a selection?

not JSP

selectionparts

Marry girl

Be free!!

Like this!

Selectionparts
  • A selection must contain at least two selection components. If It only contains one there is no selection.

Young man´s future choice

al bundy

Marry girl

We know the end…? Peg.. - make dinner!

Al Bundy?

It is however possible to leave a selection component empty.

Young man´s future choice

rules of christmas

While gifts not 0

*

Checks his

Gives one

slade

gift

Rules of Christmas

Santa Claus

X-mas day

not JSP

santa changed his mind

First

Last

Checks his

Hands out

gifts

slade

This

is CORRECT!!

While gifts not 0

*

Gives one

gift

Santa changed his mind
  • Parts connected to the same component must be of similar type

Santa Claus

X-mas day

paint house an iteration

While painter not satisfied

with color

While entire house not painted

*

*

Get paint

Paint with

Brush

Paint house - an iteration

Paint

House

not JSP

now you can begin to paint

Iterations

Get paint

Begin to

paint

While painter not satisfied

with color

While entire house not painted

*

*

Get one

can of paint

Paint with

Brush

OK !

Iteration

components

Now you can begin to paint
  • An iteration can only contain one repeated component

Paint

House

jsp editor
JSP-editor

Henrik Engström JSP-editor

pseudocode
Pseudocode

Pseudocode is a compact and informal high-level description of a computer programming algorithm that uses the structural conventions of a programming language, but is intended for human reading rather than machine reading.

bublesort algorithm in psdeudocode
BubleSort algorithm in psdeudocode

Example of pseudocode …

while not at end of listcompare adjacent elementsif second is greater than firstswitch them get next two elementsif elements were switchedrepeat for entire list