Pseudo Code

Filed under , on Wednesday, January 27, 2010

2

Pseudo Code is a sequence of lines similar like programming code and doesn’t have exact rules for writing syntax. Pseudo Code is a different way to implements algorithms beside Flowchart. Pseudo Code is more commonly used by experienced programmers. While Flowchart is more understandable for beginners, Pseudo Code supports many programming features and easy to implement into real programming code rather than Flowchart.
There are no exact rules for Pseudo Code. We can write our Pseudo Code freely as long as it is easy to understand for other persons. But it is suggested to use common used keywords in programming tool (i.e. if, then, else, while, do, repeat, for and etc.) and follow certain programming style (i.e. Pascal, C++, etc.). See the code below:
   
    Program Start
    Read a number
    Read a number, store it and write it
    Get the number before and write it
    Repeat
    End Program
Although Pseudo Code above is still understandable but some statements is ambiguous. From second to forth lines, we don’t know where the number currently read store into, and we also don’t know which number is exactly for “the number before”. Is it the first number read or the second one ? And for “Repeat”, we hardly tell which lines are supposed to repeat over. Pseudo Code above is modified to a better one as follows:
   
    Start
    Repeat
       Read Number1
       Read Number2
       Display Number2
       Display Number1
    Until Number1=0
    End
Pseudo Code above is better than previous one. We clearly see where the values are stored into and which values are displayed. Repeat statements will be discussed in Week 3.
   

Comments Posted (2)

great explanation, very helpful. thanx

Casinos Near Casino William Hill - MapyRO
A map showing 논산 출장안마 casinos and 안양 출장마사지 other gaming 제천 출장샵 facilities 경상북도 출장마사지 located near Casinos William Hill in William Hill, including 제주도 출장마사지 casino, bingo hall and lounges,

Post a Comment