Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algoritmos y Programacion

Similar presentations


Presentation on theme: "Algoritmos y Programacion"— Presentation transcript:

1 Algoritmos y Programacion
Computer Languages Machine language A collection of binary instructions understood by a given type of CPU Non-standard; low-level of detail related to the given hardware Very hard to understand by human programmers In order to be executed, any program must have been previously translated into machine language. Assembly language Mirrors closely a given machine language, only more readable by humans: uses mnemonics for instruction codes and names for variables High-level languages Closer to the human way of expression, using higher-level of abstraction concepts from the application area for which it is intended Mostly standardized, thus independent of a given hardware. The downside: computers do not understand high-level languages. Need a compiler to convert programs written in high-level languages into machine language. Algoritmos y Programacion JMHL

2 Example: Adding two numbers together
Suppose the two numbers we want to add are stored in memory locations 137 and 138, and we want to store the result in memory location 139. The following instructions need to be executed by the CPU: Fetch the contents of memory location 137 and store it in a register in the ALU Fetch the contents of memory location 138 and add it to the contents of the register Store the contents of the register in memory location 139 Algoritmos y Programacion JMHL

3 Example: Adding two numbers together
The machine language code to do this is: opcodes operands Algoritmos y Programacion JMHL

4 Example: Adding two numbers together
The assembly language code to do this is: LOAD $137, R1 ADD $138, R1 STORE R1, $139 With assembly language it is also possible to assign labels to memory locations. If A is a label for location 137, B is a label for location 138, and C is a label for location 139, the assembly language code can be written as LOAD A, R1 ADD B, R1 STORE R1, C Algoritmos y Programacion JMHL

5 Example: Adding two numbers together
High-level languages were developed to simplify programming. To add two numbers in C++, the programmer uses the expression c = a + b; Similar expressions are used in other programming languages FORTRAN C = A + B APL C  A + B COBOL ADD A TO B GIVING C. Algoritmos y Programacion JMHL

6 Algoritmos y Programacion
High-Level Languages Algoritmos y Programacion JMHL


Download ppt "Algoritmos y Programacion"

Similar presentations


Ads by Google