-
Home
- Programming fundamentals - a
- 6. program control functions
- Pseudocode examples for functions
Suggested pseudocode conventions for functions along with some examples.
Concept
No standard for pseudocode syntax exists. However, there are some commonly followed conventions to help make pseudocode written by one programmer easily understood by another programmer. The following describes a method for using pseudocode for functions that would be understood by programmers. Five concepts are:
- Use a
beginning phrase word to start the function
- Use a
communication phrase word to identify the items being passed into the function
- Use indentation to show the action part of the function
- Use a
communication phrase word to identify the items being passed out of the function
- Use an
ending phrase word to end the function
- Use a
calling phrase word to direct your program to use a fucntion
The following is a suggested outline of function phrase words:
Item/Purpose |
Starting Phrase Word |
Ending Phrase Word |
Beginning |
Function |
N/A |
Communication In |
Pass In: |
none |
Action |
N/A |
N/A |
Communication Out |
Pass Out: |
none |
Ending |
N/A |
Endfunction |
Calling a Function |
Call: |
none |
Examples
Here are some examples showing functions defined in pseudocode using our conventions as described above.
Pseudocode: function with no parameter passing
Function clear monitor
Pass In: nothingDirect the operating system to clear the monitor
Pass Out: nothingEndfunction
Got questions? Get instant answers now!
Pseudocode: function with parameter passing
Function delay program so you can see the monitor
Pass In: integer representing tenths of a secondUsing the operating system delay the program
Pass Out: nothingEndfunction
Got questions? Get instant answers now!
Pseudocode: function main calling the clear monitor function
Function main
Pass In: nothingDoing some lines of code
Call: clear monitorDoing some lines of code
Pass Out: value zero to the operating systemEndfunction
Got questions? Get instant answers now!
Definitions
phrase word
- Words used to make pseudocode logic clear to any reader.
Questions & Answers
I'm interested in biological psychology and cognitive psychology
what does preconceived mean
How can I develope my cognitive domain
why is communication effective
Communication is effective because it allows individuals to share ideas, thoughts, and information with others.
effective communication can lead to improved outcomes in various settings, including personal relationships, business environments, and educational settings. By communicating effectively, individuals can negotiate effectively, solve problems collaboratively, and work towards common goals.
it starts up serve and return practice/assessments.it helps find voice talking therapy also assessments through relaxed conversation.
miss
Every time someone flushes a toilet in the apartment building, the person begins to jumb back automatically after hearing the flush, before the water temperature changes. Identify the types of learning, if it is classical conditioning identify the NS, UCS, CS and CR. If it is operant conditioning, identify the type of consequence positive reinforcement, negative reinforcement or punishment
please i need answer
Wekolamo
because it helps many people around the world to understand how to interact with other people and understand them well, for example at work (job).
Agreed 👍 There are many parts of our brains and behaviors, we really need to get to know. Blessings for everyone and happy Sunday!
ARC
A child is a member of community not society elucidate ?
Isn't practices worldwide, be it psychology, be it science. isn't much just a false belief of control over something the mind cannot truly comprehend?
compare and contrast skinner's perspective on personality development on freud
Skinner skipped the whole unconscious phenomenon and rather emphasized on classical conditioning
war
explain how nature and nurture affect the development and later the productivity of an individual.
nature is an hereditary factor while nurture is an environmental factor which constitute an individual personality. so if an individual's parent has a deviant behavior and was also brought up in an deviant environment, observation of the behavior and the inborn trait we make the individual deviant.
Samuel
I am taking this course because I am hoping that I could somehow learn more about my chosen field of interest and due to the fact that being a PsyD really ignites my passion as an individual the more I hope to learn about developing and literally explore the complexity of my critical thinking skills
and having a good philosophy of the world is like a sandwich and a peanut butter 👍
Jonathan
generally amnesi how long yrs memory loss
interpersonal relationships
What would be the best educational aid(s) for gifted kids/savants?
treat them normal, if they want help then give them.
that will make everyone happy
Saurabh
Got questions? Join the online conversation and get instant answers!
Source:
OpenStax, Programming fundamentals - a modular structured approach using c++. OpenStax CNX. Jan 10, 2013 Download for free at http://cnx.org/content/col10621/1.22
Google Play and the Google Play logo are trademarks of Google Inc.