Algoritma Advenced

Writing Rules Algorithm

The text contains a description of the algorithm steps masalah.Deskripsi solution can be written notation of any nature, provided easy to read and understand. There is no standard notation in writing the text algorithm. Each person can make rules and algorithms sendiri.Namun writing, so that the notation algorithm can be easily translated into programming language notation nature, then the algorithm notation should correspond with the notation of programming languages in general.

Example command: Write the value of x and y

In the notation algorithm becomes: write (x, y)

In Turbo C language is written: printf ( "% d% d", x, y);






Type, Name, and Value

Type

In general, computer programs work by manipulating the object (data) in the memory. Object to be programmed a variety of types, for instance the type of numeric, character, string, and records (records).

Type of data can be grouped into 2, namely: basic types and type of formation. Basic type is the type that can be used directly, whereas the formation of the type formed from the basic types or from other types of formations that have been defined.

One type referred from namanya.Nilai-value covered by the declared type in the domain (domain) value. Operations (and operators) that can be done on these types are also defined. In other words a type indicated by its name, the domain values they contain, how to write the constants, and operations that can be done to him.

Basic Type

In a programming language that includes the basic types are:

1. number of logic

2. integers

3. character or string

4. real numbers

Type formation

Type of formation is the type that is defined by the programmer (user define). Type of formation drawn up by one or more basic types. There are two types of formation:

Basic 1.Tipe labeled with the name of a new type of example: BilanganBulat type: integer

BilanganBulat variable is an integer type is the same as type integer. Suppose we have a variable named X and type BilanganBulat, it means that the variable X is also of type integer.

2.Rekaman (rekord).

Tapes prepared by one or more fields storing data field.Tiap from certain basic types or from other types of formations that have been dideinisikan sebellumnya.Nama record itentukan by programmers. Because the diusun top stukturnya fields, the record also inamakan structured type (stuctured type).

Name

Every object in nature has given to nama.Nama easy to identify the object, referred to, and are distinguished from objects in the algorithm name lainya.Di used as identifiers, "something" and the programmer reference "something" that through his name. Therefore, each name must be unique, no two the same name.

In the algorithm "something" that can be named:

1.Variabel

2.Konstanta

3.Tipe formation

4.Nama Function

5.Nama Procedure

An important thing to note is, the name should be interpretive, that reflects the intrinsic value or function dikandungnya.Pemrogram highly recommended to provide an explanation of the name defined.

All names used in the algorithm should be defined or declared dibagian declaration. The declaration is used as a reference to an unknown word meanings or terjemahannya.Tempat to explain the name and type of the name.






Value

Value is the amount of data types that have been didefinisikan.Nilai content can be stored by variable name or constant name, the value of the calculation, or the value sent by fungsi.Algoritma essentially manipulate the value stored in the memory element. The value contained by the manipulated variable such as by way of: filling the other variables the same type, used for calculations, or written to the output device.

Example algorima: stirng print "Hello, how are you?" to the output device.

Version 1. String "Hello, how are you?" Direct printing without using variables.

Algorithm:

Declaration

(no)

Description

write ( "Hello, how are you?")

Version 2.String "Hello, how are you?" stored in a variable of type string.

Algorithm:

Declaration

saying: string

Description

<------ saying 'Hello, how are you? " write (words) Version 3.String "Hello, how are you?" stored as constants Algorithm: Declaration const greeting = 'Hello, how are you? " Description write (words) Output generated by the algorithm version 1, 2, and 3 are: Hello, how are you? > tukar
0 Komentar untuk "Algoritma Advenced"

Back To Top