Logic and Algorithm
Agenda:
1. What is a program?
2. language processors.
3. Steps in solving a computer problem.
4. Programming.
- algorithm. Test
- desktop.
- Encoding.
- Compiling and running.
- error rates.
Development
1. What is a program?
- logical sequence: refers to the order in which instructions will be executed by the compiler.
program in two ways: linear and nonlinear.
- Linear: means to execute instructions as they are, without any fork, or dedición or repetitive structures.
- Nonlinear concerns that are not going to follow the instructions in that order but it may vary depending on the logical order logic.
should add that there are two types of program: source and object:
- Source: the programmer writes in a particular programming language.
- Object: is the program that uses the computer. Is the translation of source language the computer understands. Ones and zeros.
2. language processors.
language processors are programs that take the source program and convert it to language of the machine.
These are divided into two categories:
- compiler: the program supplied by the manufacturer of the language. This makes the following functions:
· translates the source language functions.
· memory space allocation.
· Create an error report in the program.
· create the program object (only if the source is free from errors).
· Provides variables and other data.
· Compilation is the process where it becomes the source program instructions in the language of the machine.
- Interpret: is a program that will read the program line by line and translating and executing it goes. In this case, there is no complete translation .
3. Steps in solving a computer problem.
In devising a solution to a given problem must be that it is a task that involves art and science. Art that requires ingenuity, boldness, subtlety, and so on. That science has a methodology to follow.
- Defining the problem: here we must ask what the problem theoretically. We must have a clear vision of what we have and need to throw the desired results. I have to think that input I need to get what I want. Input data refers to the type of data they need to solve the problem.
- Analysis and design of the program: At this time we have a clear vision of what things I do and in what order should I run to yield the desired product. It should be noted that we should expect all the problems that may occur in the program.
All analyzes developer must ask: what do I have?, What should I do?, What should I produce?, How do I prevent problems? Etc.
4. Programming.
Programming, define it as a way to solve a given problem in the most efficient way possible. Not just write a program, if not, make finding a solution to the problem.
different techniques are used as algorithms, data flow diagrams (DFD's), desktop test, etc.
- Algorithm is a technique that helps us think about possible solution of the problem, any circumstances that arise and that an accurate solution is unique and finite. The algorithm is the tool used to translate the logical sequence of the program. The way of writing the algorithm is called pseudocode. Its characteristics is that it must be accurate, concise, finite and defined.
Rules for making algorithms:
1. All instructions must be written in upper case closed.
2. If multiple instructions can be separated by commas.
3. All algorithm should start with the word begins and ends with END.
4. To write instructions, either entry, exit or other, must be written in the format given.
5. alphanumeric constants must be enclosed in quotes.
6. To call a subroutine or procedure will be done with the word RUN, followed by the name of the procedure.
7. In an algorithm is possible to use arithmetic operators (+,-,*,/,>, <,<>, =) as the logical (AND, OR, NOT).
- desktop test, is to make a comprehensive test program to verify that produces the desired results and is free of errors.
- Coding: This is to translate each line of the algorithm, a particular programming language.
- Compilation: to transform the source program into a language the computer understands. Here you create the program object.
- Execution: the computer is going line by line running the program object (compiled source our program).
- types of errors are those detected at compile time. These are:
· Compile Error: these errors are found at the time of compilation. Are due to error or failure of the syntax of the language. If there is a syntax error, the compiler does not recognize the instruction and therefore will not create the program object or statement appear.
· execution errors are those errors where you run when you can not. Read the instruction, but can not perform. Example: division by zero, the root of a negative number, etc.
· logical errors: errors are more difficult to detect because it does not display non-performance compilation errors. Is due to bad platemiento and resolving the problem.