EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.

12

Transcript of EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.

Page 1: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.
Page 2: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.

• EXPRESIONES

• REGLAS PARA ELABORAR

SEUDOCODIGOS Y DIAGRAMA DE

FLUJO

• ERRORES SEMANTICOS Y

LOGICOS

Page 3: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.

EXPRESIONES

LAS EXPRESIONES SON COMBINACIONES DE CONSTANTES, VARIABLES, SÍMBOLOS DE OPERACIÓN, PARÉNTESIS Y NOMBRES DE FUNCIONES ESPECIALES. POR EJEMPLO: A + (B + 3) / CADA EXPRESIÓN TOMA UN VALOR QUE SE DETERMINA TOMANDO LOS VALORES DE LAS VARIABLES Y CONSTANTES IMPLICADAS Y LA EJECUCIÓN DE LAS OPERACIONES INDICADAS. UNA EXPRESIÓN CONSTA DE OPERADORES Y OPERANDO. SEGÚN SEA EL TIPO DE DATOS QUE MANIPULAN, SE CLASIFICAN LAS EXPRESIONES EN:

* ARITMÉTICAS

* RELACIONALES

* LÓGICAS

Page 4: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.

OPERADORES Y OPERANDO

Son elementos que relacionan de forma diferente, los valores de una o más variables y/o constantes. Es decir, los operadores nos permiten manipular valores.

• Operadores Aritméticos

Los operadores aritméticos permiten la realización de operaciones matemáticas con los valores (Variables y constantes).Los operadores aritméticos pueden ser utilizados con tipos de datos enteros o reales. Si ambos son enteros, el resultado es entero; si alguno de ellos es real, el resultado es real.

Operadores Aritméticos :

+ Suma

- Resta

* Multiplicación

/ División

mod Modulo (residuo de la división entera)

Ejemplos:

Expresión Resultado

7 / 2 3.5

12 mod 7 5

4 + 2 * 5 14

Page 5: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.

• Prioridad de los Operadores Aritméticos

Todas las expresiones entre paréntesis se evalúan primero. Las expresiones con paréntesis anidados se evalúan de dentro a fuera, el paréntesis más interno se evalúa primero. Dentro de una misma expresión los operadores se evalúan en el siguiente orden:

1) ^ Exponenciación2) *, /, mod Multiplicación, división, modulo.3) +, - Suma y resta.

Los operadores en una misma expresión con igual nivel de prioridad se evalúan de izquierda a derecha.

Ejemplos:4+ 2 * 5 = 1423 * 2 / 5 = 9.23 + 5 * (10 - (2 + 4)) = 232.1 + (1.5 + 12.3) = 2.1* 13.8 = 29.98

Page 6: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.
Page 7: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.

EJEMPLO

Obtener el factorial de un numero

1. Inicio

2. Mostar “dame el numero”

3. Leer N

4. F=1

5. Si (N>1)

entonces

Calcular F=F*N

Calcular N=N-1

si no

Mostrar F

6. FIN

Page 8: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.
Page 9: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.

SIMBOLOS

Page 10: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.

EJEMPLOObtener el factorial de un numero

Page 11: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.

ERRORES SEMANTICOS Y LOGICOS

• Errores Semánticos: son más sutiles. Un error semántico se produce cuando la sintaxis del código es correcta, pero la semántica o significado no es el que se pretendía. La construcción obedece las reglas del lenguaje, y por ello el compilador o intérprete no detectan los errores semánticos. Los compiladores e intérpretes sólo se ocupan de la estructura del código que se escribe, y no de su significado. Un error semántico puede hacer que el programa termine de forma anormal, con o sin un mensaje de error. Hablando en términos coloquiales, puede hacer que el equipo se quede "colgado".

Page 12: EXPRESIONES REGLAS PARA ELABORAR SEUDOCODIGOS Y DIAGRAMA DE FLUJO ERRORES SEMANTICOS Y LOGICOS.

ERRORES LOGICOS

• Los errores lógicos son aquellos que aparecen cuando la aplicación está en funcionamiento. Son a menudo resultados no deseados o inesperados en respuesta a acciones del usuario. Por ejemplo, una clave mal escrita u otra influencia externa podría hacer que la aplicación dejase de funcionar aún siendo correctos los parámetros, o que simplemente no funcionase. Por lo general, los errores lógicos son los más difíciles de corregir, puesto que no siempre está claro dónde se originan.