1 / 25

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?. Morning routine. Get dressed. Eat breakfast. Go to school. Division. Time. Structure diagram. By 2IT Data students …. ”Morningwhile has gold in mouthd”. Morning routine.

noura
Download Presentation

Från verkligt problem till Datorprogram?

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Från verkligt problem till Datorprogram? Du vet vad Du vill göra, men hur kommer man till ett färdigt C-program?

  2. Morning routine Get dressed Eat breakfast Go to school Division Time Structure diagram By 2IT Data students … ”Morningwhile has gold in mouthd”

  3. 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

  4. 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

  5. What colour on your socks? If blue doesn’t exist,but pink does If blue exists Else Blue Pink White Selection Selection Selection parts

  6. 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

  7. Drink beer (lightbeer) Many glassesof beer One beer Iteration (repetition) Iteration As long as you’re thirsty Iteration part

  8. 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

  9. 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.

  10. 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

  11. 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

  12. Young man´s future choice Marry girl Marriage - a selection? not JSP

  13. 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

  14. 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

  15. While gifts not 0 * Checks his Gives one slade gift Rules of Christmas Santa Claus X-mas day not JSP

  16. 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

  17. While painter not satisfied with color While entire house not painted * * Get paint Paint with Brush Paint house - an iteration Paint House not JSP

  18. 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

  19. JSP-editor Henrik Engström JSP-editor

  20. Generate C

  21. Web-Quiz

  22. Web-Quiz

  23. 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.

  24. 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

  25. Lycka till med övningarna!

More Related