What is the best way to learn to write very clear pseudo-code (using easy-to-understand statements, not including syntax that is not easy to explain), and similar to code that uses mathematical operators. So my question is, what is the best way to learn and practice this in my exam?
1. Have a clear idea of what the purpose is and document it.
2. List out the steps required to achieve that end as if you are explaining it to someone who hasn't got a clue what a programming language is.
3. Check, refine and revise as required.
4. Repeat starting at 1 until finished, if finished, proceed to step 5.
5. Go back to step 1. (Just joking).
for a large project with multiple people, you should take a day or 2 to define the pcode format and have everyone do it the same way. the rules should be very simple, but you still need something eg do you want to say start/stop or begin/end for code blocks, do you use c++ like syntax or basic-like syntax or pascal like or??? how will you denote comments, OOP constructs?
if its just you, anything goes but generally you just ditch the syntax heavy stuff.
for example cout is an unholy mess of formatters and << symbols, just say
or a for loop, just say
for i = 1 to 10
things like that.
I sort of disagree with #2 above. the point of pcode it to use it to later write real code or to explain an algorithm (eg a wiki page) without a specific language so any *coder* can make use of it. I don't think its possible to write it in a way that a non-programmer could make any use of it for anything, unless maybe it also solves a math problem that a non coder might do by hand (eg find sqrt by hand algorithm) or something like that (in which case, don't even write pcode, just lay out the steps in math-speak).
pick something simple that you understand well (eg, bubblesort, binary search, vending machine simulator, whatever) and give it a shot. When its done, see if you can follow it to make the real program.
There's no definition of what pseudo-code involves. Some programming courses teach this, but use their own variation of words and how things like loops are documented. It's used to express the ideas/process behind an algorithm without getting 'bogged' down in specific language syntax (which can sometimes be a pain!). It can be considered as one step up from the old flow charts.
For your own use, one way is just to write in concise English (or other known language). In a company that uses this, the rules/format etc will have been defined and you'll be expected to follow.
The important thing is the expression of idea etc rather than the exact way you write it.
PS Don't confuse pseudo-code with p-code (or pcode). p-code is a very low-level code that is machine independent and enables a compiled file to be run on different processor types