Now, if you're a beginner; i'm going to explain this topic clearly to you. That's what you're here for right?
Pseudo code or Pseudocode or Pseudo-code is an English-like representation of a programming language intended for human reading rather than machine reading. It is not a programming language or an executable program; but it explains how a particular code should be written, omitting the actual codes that the machine would recognize on a normal day. Pseudocode is mostly found in textbooks related to computer science and other similar contents that talk about various tools or methods of representing Algorithms.
Unlike flowchart, Pseudocode does not use shapes. It follows a sequential step by step arrangement of the instructions to be performed to accomplish a task. It is an informal and artificial language that help programmers develop Algorithms.
Another Definition? Pseudocode are statements outlining the operation of a computer program, written in something similar to computer language but in a more understandable format.
Pseudo code or Pseudocode or Pseudo-code is an English-like representation of a programming language intended for human reading rather than machine reading. It is not a programming language or an executable program; but it explains how a particular code should be written, omitting the actual codes that the machine would recognize on a normal day. Pseudocode is mostly found in textbooks related to computer science and other similar contents that talk about various tools or methods of representing Algorithms.
Unlike flowchart, Pseudocode does not use shapes. It follows a sequential step by step arrangement of the instructions to be performed to accomplish a task. It is an informal and artificial language that help programmers develop Algorithms.
Another Definition? Pseudocode are statements outlining the operation of a computer program, written in something similar to computer language but in a more understandable format.
Now, for a clearer explanation, lets quote a few other sources on the web regarding this subject.
According to Wikipedia: A programmer who needs to implement a specific algorithm, especially an unfamiliar one, will often start with a pseudocode description, and then "translate" that description into the target programming language and modify it to interact correctly with the rest of the program. Programmers may also start a project by sketching out the code in pseudocode on paper before writing it in its actual language, as a top-down structuring approach, with a process of steps to be followed as a refinement.
Write a Pseudocode to find the greatest of 3 numbers represented as X, Y and Z
Solution
According to Wikipedia: A programmer who needs to implement a specific algorithm, especially an unfamiliar one, will often start with a pseudocode description, and then "translate" that description into the target programming language and modify it to interact correctly with the rest of the program. Programmers may also start a project by sketching out the code in pseudocode on paper before writing it in its actual language, as a top-down structuring approach, with a process of steps to be followed as a refinement.
According to Vangie Beal: ... outline of a program, written in a form that can easily be converted into real programming statements. For example, the pseudocode for a bubble sort routine might be written: while not at end of list compare adjacent elements if second is greater than first switch them get next two elements if elements were switched repeat for entire list
Pseudocode cannot be compiled nor executed, and there are no real formatting or syntax rules. It is simply one step - an important one - in producing the final code. The benefit of pseudocode is that it enables the programmer to concentrate on the algorithms without worrying about all the syntactic details of a particular programming language. In fact, you can write pseudocode without even knowing what programming language you will use for the final implementation.
Now, lets take a look at a Pseudocode Example below... Two Pseudocode examples? Okay
First ExamplePseudocode cannot be compiled nor executed, and there are no real formatting or syntax rules. It is simply one step - an important one - in producing the final code. The benefit of pseudocode is that it enables the programmer to concentrate on the algorithms without worrying about all the syntactic details of a particular programming language. In fact, you can write pseudocode without even knowing what programming language you will use for the final implementation.
Now, lets take a look at a Pseudocode Example below... Two Pseudocode examples? Okay
Write a Pseudocode to find the greatest of 3 numbers represented as X, Y and Z
Solution
Begin Process
Input X, Y, Z
If A>B then the greatest = A
Else greatest = B
If greatest <C then greatest = C
Output greatest
End Process
Second Example
Write an Algorithm to determine a Pupil's final grade and indicate whether it is pass or fail. The final grade is calculated as the average of four marks.
Solution
**For us to determine if the pupil passed or Failed; we have to set a Pass mark. So, if he/she gets BELOW the pass mark, we indicate he/she failed. Let our pass mark be 40 and above**
- Begin
- Input a set of 4 marks
- Calculate their average by summing and dividing by 4
- If average is below 40 print "Fail"
- Else print "Pass"
- End
Or
- Begin
- Step 1: Input N1, N2, N3, N4
- Step 2: Grade (N1 + N2 + N3 + N4) /4
- Step 3: If (Grade <40) then print "FAIL"
- Else, Print "PASS"
- End
0 comments:
Post a Comment