Pseudocode: Difference between revisions

From Computer Science Wiki
No edit summary
Line 10: Line 10:


Pseudocode is a simple way of writing programming code in English. Pseudocode is not actual programming language. It uses short phrases to write code for programs before you actually create it in a specific language. Once you know what the program is about and how it will function, then you can use pseudocode to create statements to achieve the required results for your program.<ref>http://study.com/academy/lesson/pseudocode-definition-examples-quiz.html</ref>
Pseudocode is a simple way of writing programming code in English. Pseudocode is not actual programming language. It uses short phrases to write code for programs before you actually create it in a specific language. Once you know what the program is about and how it will function, then you can use pseudocode to create statements to achieve the required results for your program.<ref>http://study.com/academy/lesson/pseudocode-definition-examples-quiz.html</ref>
== Common psuedocode verbs ==
Common Action Keywords<ref>http://users.csc.calpoly.edu/~jdalbey/SWE/pdl_std.html</ref>
Several keywords are often used to indicate common input, output, and processing operations.
'''Input:''' READ, OBTAIN, GET
'''Output''': PRINT, DISPLAY, SHOW
'''Compute:''' COMPUTE, CALCULATE, DETERMINE
'''Initialize:''' SET, INIT
'''Add one:''' INCREMENT, BUMP


== Examples of pseudocode ==
== Examples of pseudocode ==

Revision as of 11:58, 4 May 2016

Exclamation.png This is an important concept you should fully understand this.

This is a basic concept in computer science

Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a normal programming language, but is intended for human reading rather than machine reading.[1]

Pseudocode is a simple way of writing programming code in English. Pseudocode is not actual programming language. It uses short phrases to write code for programs before you actually create it in a specific language. Once you know what the program is about and how it will function, then you can use pseudocode to create statements to achieve the required results for your program.[2]

Common psuedocode verbs[edit]

Common Action Keywords[3]

Several keywords are often used to indicate common input, output, and processing operations. Input: READ, OBTAIN, GET Output: PRINT, DISPLAY, SHOW Compute: COMPUTE, CALCULATE, DETERMINE Initialize: SET, INIT Add one: INCREMENT, BUMP


Examples of pseudocode[edit]

[4] Example 1:

If student's grade is greater than or equal to 60

Print "passed"
else
Print "failed"

Question for you to think about:

  • What do you notice about the structure of this code?
  • Could you program this in Python or PHP?


[5] Example 2:

Set total to zero

Set grade counter to one

While grade counter is less than or equal to ten

Input the next grade
Add the grade into the total
Set the class average to the total divided by ten

Print the class average.

What you must know[edit]

You must be able to correctly answer the following questions:

Why is this so important?[edit]

When you are first building a program, we don't really care about the actual LANGUAGE or SYNTAX you will use. Rather, we care about your logic. Pseudocode helps you by showing logic rather than syntax.

References[edit]