Pseudocode and Flowchart

Expressions of Algorithm

  • Natural language
屏幕快照 2016-11-18 上午8.18.42.png

  • Flow Chart – formalized graphic representation

54e558538a5b9003dbe8896fb6338669-2.jpgimg2

  • Pseudocode – generic artificial language
屏幕快照 2016-11-18 上午8.20.13.png
  • Programming Language – artificial language to communicate with computer system

屏幕快照 2016-11-15 上午8.49.46.png

When we are programming, we actually go through this translation process in mind or by writing down: natural language→ pseudocode→ apply syntax in the programming language.

Pseudocode & Flow Chart

屏幕快照 2016-11-18 上午8.38.56.png

屏幕快照 2016-11-18 上午8.40.20.png

屏幕快照 2016-11-18 上午8.41.36.png

Exercise


Write pseudo code that reads two numbers and multiplies them together and print out their product.

IMG_2127.JPG


Write pseudo code that tells a user that the number they entered is not a 5 or a 6.

IMG_2127 2.JPG


Write pseudo code that performs the following: Ask a user to enter a number. If the number is between 0 and 10, write the word blue. If the number is between 10 and 20, write the word red. If the number is between 20 and 30, write the word green. If it is any other number, write that it is not a correct color option.

3.JPG


Write pseudo code to print all multiples of 5 between 1 and 100 (including both 1 and 100). If A mod 5=0

4.JPG


Write pseudo code that will count all the even numbers up to a user defined stopping point.

5(Answers Pictures in Exercise were made by the author herself.)

Personal Reflection: In this class, I learned how to write Pseudo code and draw flow chart. There are many rules, for instance, we should use different shapes to represent different type of commands in flowchart, “input” in Pseudo code should always be written in small letter.

Works Cited

Cisneros, Pablo G. “The 10 Algorithms Every Computer Science Student Must Implement”. Linkedin. N.p., 2016. Web. 17 Nov. 2015.

留下评论