Difference between revisions of "Pseudo Code"
Mfrederick (talk | contribs) (Created page with "== Back To Basics... == Pseudocode is a simple way of writing programming code in English. Pseudocode is not actual a programming language. It uses short phrases to write code...") |
Mfrederick (talk | contribs) (→Do It All In A Step By Step Basis..) |
||
Line 46: | Line 46: | ||
==== Do It All In A Step By Step Basis.. ==== | ==== Do It All In A Step By Step Basis.. ==== | ||
* Think Logically... | * Think Logically... | ||
− | + | * What are my inputs, outputs
and so on? | |
− | + | * What is the question asking me? | |
− | + | * What are the numbers? Are they integers? Is it a boolean? | |
== Now It Is Your Turn… == | == Now It Is Your Turn… == |
Revision as of 12:34, 15 December 2016
Contents
Back To Basics...
Pseudocode is a simple way of writing programming code in English. Pseudocode is not actual a programming language. It uses short phrases to write code for programs before you actually create it in a specific language (i.e C++). 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.
Common Keywords For Pseudocode…
- Input = indicates a user will be inputting something into the code
- Output = indicates that there will be an output from the program
- While = a loop (until a condition has been met)
- For = a continuous loop
- Repeat - Until = a loop that has a condition until the end
- If - Then - Else = a decision in which a choice is made
- Any other instruction that occurs inside a selection or iteration are usually indented
Exmaples - What Do They Do?
Set total to zero
Set grade counter to one
While grade counter is < 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.
Another
REPEAT OUTPUT ‘What is the best subject you take?’ INPUT user inputs the best subject they take STORE the user’s input in the answer variable IF answer = ‘Computer Science’ THEN OUTPUT ‘Of course it is!’ ELSE OUTPUT ‘Try again!’ UNTIL answer = ‘Computer Science
When You Are Writing You Pseudocode, you have to take into consideration the following…
- What are all of your inputs?
- What are all of your outputs?
- In what order does the code need to be carried out?
- What decisions need to be made in the code?
- Is there any area of the code that is repeated?
How To Tackle An Exam Question
Do It All In A Step By Step Basis..
- Think Logically...
* What are my inputs, outputs and so on? * What is the question asking me? * What are the numbers? Are they integers? Is it a boolean?
Now It Is Your Turn…
Write you own pseudocode for anything that you want. If you are stuck here are a few ideas:
- How to make a cheese toastie
- How to get ready in the morning
- How to warm up a ready meal