Pseudocode
Pseudocode is a series of simple human language that is concise and clear so it is easy to understand. Some keywords used to receive inputs and outputs in a pesudocode that read, get, print, write, etc. While the flow chart used by many programmers to design an algorithm. When pseudocode using words to describe these algorithms, flow charts using symbols and a few words to illustrate an algorithm.Before you start designing the algorithm, it is necessary to know that the computer can operate six basic operationsis:
- The computer can ask for input from the System / keyboard, or read from a file.
- The computer can generate an output and display it to the screen, or write to a file.
- The computer can perform looping operations.
- The computer can perform the selection operation.
- The computer also can compare the values of two variables. 6. The computer can perform initialization or allocate a value into memory.
Here is an example of pseudocode that aims to Call
BEGIN
Hold up the phone
WHILE not dial
Press dial button
WHILE not connected
Waiting dial
IF connected THEN
WHILE not finish
Talking
Hold down the phone
END
Description
For a pseudocode always starts with the keyword BEGIN and END keywords to end use. Based pseudocode for the call, then the first step is to remove algae phone. Then there is a check accompanied by a looping condition, wherein when the phone has not heard a dial tone then press the call back number. But when it heard the dial tone then there is the next check is whether the phone has been connected to the intended person. If not then it will be looping is wait until the phone is connected to the intended person (appointed). When connected then there are checks that if the conversation is not over then continue talking. At the end of the phone is closed again.
Specify a value-odd or even number.
BEGIN
Number = Input Number
Result = Number % 2
IF Result = 0
THEN Print “The number is even number”
ELSE
THEN Print “The number is odd number”
END
Description
To determine the number of odd and even, to use the calculation modulus (%) is looking for the rest of the division. As we know that a number can be categorized as an odd number if there is the quotient between the number by 2. Then the pseudocode Menentukan_bilangan_ganjil_genap, the first step is to store input from the user to the variable Number. Then calculate the remainder of the division of numbers, where the results are stored in the variable Result. If you already know the results Resultnya, then the next step is to check whether the results of the remainder is 0 (even number) or 1 (odd number).
Flow Chart
As discussed previously that a flowchart may describe the algorithm is illustrated in the form of images. We need to know the symbols used in a flow chart, as follows:
Each of these symbols have different meanings. Here is a brief description of the symbol:
- Terminator is used to define when an algorithm is started or stopped. We used to use for the BEGIN and END.
- Flow line is used to provide flow direction algorithms and data. (connecting symbols with one another).
- Preparation: used for preparation such as initialize values, etc.
- Process: To describe a process.
- Input / Output Data: illustrates that the data is output / input.
- Decision: used to indicate a selection.
- On page connector: used to connect / resume flow chart on the same page.
- Off page connector: used to connect / resume flow chart on a different page.
- Here is an example of a flow chart of the two pesudocode above (call and determine odd even).
:
Conversion Conversion Emoticon Emoticon