SlideShare una empresa de Scribd logo
1 de 26
Tema 5 Sentencias de control Fundamentos de Programación I.E.S. Juan de Garay
Tema 5: Sentencias de control ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1. La estructura if ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1. La estructura if (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1. La estructura if (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
2. La estructura switch ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
2. La estructura switch (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
2. La estructura switch (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
2. La estructura switch (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Si se pulsa Se ejecuta 1 Funcion2 ( ) y Funcion3 ( ) 2 Funcion2 ( ) y Funcion3 ( ) 3 Funcion3 ( ) 4 Funcion4_1( ) y Funcion4_2( ) 5 Funcion5 ( ) y FuncionX ( ) Cualquier otra cosa FuncionX ( )
2. La estructura switch (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
3. Bucles ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
3. Bucles (cont.) ,[object Object],incremento cuerpo_del_bucle condición inicialización FALSA VERDADERA
3. Bucles (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
3. Bucles (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
3. Bucles (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
3. Bucles (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
3. Bucles (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
3. Bucles (cont.) ,[object Object],[object Object],[object Object],[object Object],expresión FALSA VERDADERA cuerpo_del_bucle
3. Bucles (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
3. Bucles (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
3. Bucles (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],cuerpo_del_bucle expresión VERDADERA FALSA
4. Sentencia break ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5. Sentencia continue ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
3. Bucles (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5. Sentencia continue (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
6. Etiquetas y sentencia goto ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],En este ejemplo, la única alternativa a goto sería la realización de varias comprobaciones en cada bucle que forzase sentencias break. ¡OJO! NO DEBE UTILIZARSE EN PROGRAMACIÓN ESTRUCTURADA.

Más contenido relacionado

La actualidad más candente

Ejemplo C++
Ejemplo C++Ejemplo C++
Ejemplo C++David
 
5.1 instruccion if-else
5.1 instruccion if-else5.1 instruccion if-else
5.1 instruccion if-elseSNPP
 
Introducción A Las Estructuras De Seleccion En C
Introducción A Las Estructuras De Seleccion En CIntroducción A Las Estructuras De Seleccion En C
Introducción A Las Estructuras De Seleccion En Cpainni
 
Estructuras De Control
Estructuras De ControlEstructuras De Control
Estructuras De Controlmtemarialuisa
 
Estructuras de seleccion
Estructuras de seleccionEstructuras de seleccion
Estructuras de seleccionClariza
 
4. estructuras selectivas
4. estructuras selectivas4. estructuras selectivas
4. estructuras selectivasmartell024
 
Clase lenguaje c
Clase lenguaje c Clase lenguaje c
Clase lenguaje c Mar15marian
 
Estructuras de control
Estructuras de controlEstructuras de control
Estructuras de controlLic_Vera
 
ESTRUCTURAS DE CONTROL: BUCLES EN C++
ESTRUCTURAS DE CONTROL: BUCLES EN C++ESTRUCTURAS DE CONTROL: BUCLES EN C++
ESTRUCTURAS DE CONTROL: BUCLES EN C++die_dex
 
Curso Java Inicial 3 Sentencias De Control De Flujo
Curso Java Inicial   3 Sentencias De Control De FlujoCurso Java Inicial   3 Sentencias De Control De Flujo
Curso Java Inicial 3 Sentencias De Control De FlujoEmilio Aviles Avila
 
Estructuras iterativas en java y pseudocódigo
Estructuras iterativas en java y pseudocódigoEstructuras iterativas en java y pseudocódigo
Estructuras iterativas en java y pseudocódigoAlex Cordova
 
Sentencias de repetición en Java
Sentencias de repetición en JavaSentencias de repetición en Java
Sentencias de repetición en JavaJdcaste
 

La actualidad más candente (17)

Ejemplo C++
Ejemplo C++Ejemplo C++
Ejemplo C++
 
5.1 instruccion if-else
5.1 instruccion if-else5.1 instruccion if-else
5.1 instruccion if-else
 
Introducción A Las Estructuras De Seleccion En C
Introducción A Las Estructuras De Seleccion En CIntroducción A Las Estructuras De Seleccion En C
Introducción A Las Estructuras De Seleccion En C
 
Estructuras De Control
Estructuras De ControlEstructuras De Control
Estructuras De Control
 
Estructuras de seleccion
Estructuras de seleccionEstructuras de seleccion
Estructuras de seleccion
 
Diagramas De Flujo
Diagramas De FlujoDiagramas De Flujo
Diagramas De Flujo
 
4. estructuras selectivas
4. estructuras selectivas4. estructuras selectivas
4. estructuras selectivas
 
Clase lenguaje c
Clase lenguaje c Clase lenguaje c
Clase lenguaje c
 
41 Php. Bucles For
41 Php. Bucles For41 Php. Bucles For
41 Php. Bucles For
 
Estructuras de control
Estructuras de controlEstructuras de control
Estructuras de control
 
Manual
ManualManual
Manual
 
Estructura selectiva
Estructura selectivaEstructura selectiva
Estructura selectiva
 
ESTRUCTURAS DE CONTROL: BUCLES EN C++
ESTRUCTURAS DE CONTROL: BUCLES EN C++ESTRUCTURAS DE CONTROL: BUCLES EN C++
ESTRUCTURAS DE CONTROL: BUCLES EN C++
 
Curso Java Inicial 3 Sentencias De Control De Flujo
Curso Java Inicial   3 Sentencias De Control De FlujoCurso Java Inicial   3 Sentencias De Control De Flujo
Curso Java Inicial 3 Sentencias De Control De Flujo
 
Estructuras iterativas en java y pseudocódigo
Estructuras iterativas en java y pseudocódigoEstructuras iterativas en java y pseudocódigo
Estructuras iterativas en java y pseudocódigo
 
Sentencias de repetición en Java
Sentencias de repetición en JavaSentencias de repetición en Java
Sentencias de repetición en Java
 
Java básico
Java  básicoJava  básico
Java básico
 

Similar a Fpr Tema 5 www.fresymetal.com

Sentencias condicionales y ciclos
Sentencias condicionales y ciclosSentencias condicionales y ciclos
Sentencias condicionales y ciclosSohar Carr
 
ESTRUCTURAS DE SELECCIÓN SENTENCIAS IF Y SWITCH EN C++
ESTRUCTURAS DE SELECCIÓN SENTENCIAS IF Y SWITCH EN C++ESTRUCTURAS DE SELECCIÓN SENTENCIAS IF Y SWITCH EN C++
ESTRUCTURAS DE SELECCIÓN SENTENCIAS IF Y SWITCH EN C++die_dex
 
estructuras de repeticion
estructuras de repeticionestructuras de repeticion
estructuras de repeticionadark
 
Estructuras de control en Java
Estructuras de control en JavaEstructuras de control en Java
Estructuras de control en Javaquesada_diego
 
5.3 instruccion while
5.3 instruccion while5.3 instruccion while
5.3 instruccion whileSNPP
 
Estructuras De RepeticióN
Estructuras De RepeticióNEstructuras De RepeticióN
Estructuras De RepeticióNRegina Flores
 
Estructuras De RepeticióN
Estructuras De RepeticióNEstructuras De RepeticióN
Estructuras De RepeticióNRegina Flores
 
DAW-Estructuras de control
DAW-Estructuras de controlDAW-Estructuras de control
DAW-Estructuras de controlvay82
 
Alexander power point
Alexander power pointAlexander power point
Alexander power point20081027
 
Scjp Jug Section 2 Flow Control
Scjp Jug Section 2 Flow ControlScjp Jug Section 2 Flow Control
Scjp Jug Section 2 Flow ControlJose Selman
 
Estructuras condicionales
Estructuras condicionalesEstructuras condicionales
Estructuras condicionalesSTEVENZAFIRO
 
Sentencias de Programacion
Sentencias de ProgramacionSentencias de Programacion
Sentencias de Programacionaeroscar90
 
Php04 estructuras control
Php04 estructuras controlPhp04 estructuras control
Php04 estructuras controlJulio Pari
 

Similar a Fpr Tema 5 www.fresymetal.com (20)

Sentencias condicionales y ciclos
Sentencias condicionales y ciclosSentencias condicionales y ciclos
Sentencias condicionales y ciclos
 
ESTRUCTURAS DE SELECCIÓN SENTENCIAS IF Y SWITCH EN C++
ESTRUCTURAS DE SELECCIÓN SENTENCIAS IF Y SWITCH EN C++ESTRUCTURAS DE SELECCIÓN SENTENCIAS IF Y SWITCH EN C++
ESTRUCTURAS DE SELECCIÓN SENTENCIAS IF Y SWITCH EN C++
 
estructuras de repeticion
estructuras de repeticionestructuras de repeticion
estructuras de repeticion
 
Iteraciones y decisiones en c++
Iteraciones y decisiones en c++Iteraciones y decisiones en c++
Iteraciones y decisiones en c++
 
Estructura repetitiva
Estructura repetitivaEstructura repetitiva
Estructura repetitiva
 
Estructuras de control en Java
Estructuras de control en JavaEstructuras de control en Java
Estructuras de control en Java
 
5.3 instruccion while
5.3 instruccion while5.3 instruccion while
5.3 instruccion while
 
Estructuras De RepeticióN
Estructuras De RepeticióNEstructuras De RepeticióN
Estructuras De RepeticióN
 
Estructuras De RepeticióN
Estructuras De RepeticióNEstructuras De RepeticióN
Estructuras De RepeticióN
 
DAW-Estructuras de control
DAW-Estructuras de controlDAW-Estructuras de control
DAW-Estructuras de control
 
Alexander power point
Alexander power pointAlexander power point
Alexander power point
 
Scjp Jug Section 2 Flow Control
Scjp Jug Section 2 Flow ControlScjp Jug Section 2 Flow Control
Scjp Jug Section 2 Flow Control
 
Estructuras condicionales
Estructuras condicionalesEstructuras condicionales
Estructuras condicionales
 
Instruccion while bm
Instruccion while bmInstruccion while bm
Instruccion while bm
 
C++
C++C++
C++
 
Sentencias de Programacion
Sentencias de ProgramacionSentencias de Programacion
Sentencias de Programacion
 
03 iteracion
03 iteracion03 iteracion
03 iteracion
 
Guia4
Guia4Guia4
Guia4
 
Php04 estructuras control
Php04 estructuras controlPhp04 estructuras control
Php04 estructuras control
 
Sentencias
SentenciasSentencias
Sentencias
 

Más de FresyMetal

Tema 12 www.fresymetal.com
Tema 12 www.fresymetal.comTema 12 www.fresymetal.com
Tema 12 www.fresymetal.comFresyMetal
 
Tema 10 www.fresymetal.com
Tema 10 www.fresymetal.comTema 10 www.fresymetal.com
Tema 10 www.fresymetal.comFresyMetal
 
Tema 9 www.fresymetal.com
Tema 9 www.fresymetal.comTema 9 www.fresymetal.com
Tema 9 www.fresymetal.comFresyMetal
 
Tema 7 www.fresymetal.com
Tema 7 www.fresymetal.comTema 7 www.fresymetal.com
Tema 7 www.fresymetal.comFresyMetal
 
Tema 8 www.fresymetal.com
Tema 8 www.fresymetal.comTema 8 www.fresymetal.com
Tema 8 www.fresymetal.comFresyMetal
 
Fpr Tema6 www.fresymetal.com
Fpr Tema6 www.fresymetal.comFpr Tema6 www.fresymetal.com
Fpr Tema6 www.fresymetal.comFresyMetal
 
Fpr Tema 4 www.fresymetal.com
Fpr Tema 4 www.fresymetal.comFpr Tema 4 www.fresymetal.com
Fpr Tema 4 www.fresymetal.comFresyMetal
 
Fpr Tema 3 www.fresymetal.com
Fpr Tema 3 www.fresymetal.comFpr Tema 3 www.fresymetal.com
Fpr Tema 3 www.fresymetal.comFresyMetal
 
Fpr Tema 2 www.fresymetal.com
Fpr Tema 2 www.fresymetal.comFpr Tema 2 www.fresymetal.com
Fpr Tema 2 www.fresymetal.comFresyMetal
 
Fpr Tema 1 www.fresymetal.com
Fpr Tema 1 www.fresymetal.comFpr Tema 1 www.fresymetal.com
Fpr Tema 1 www.fresymetal.comFresyMetal
 
Tema 3 Ficheros Y Permisos
Tema 3 Ficheros Y PermisosTema 3 Ficheros Y Permisos
Tema 3 Ficheros Y PermisosFresyMetal
 
Tema 3 Ficheros Y Permisos
Tema 3 Ficheros Y PermisosTema 3 Ficheros Y Permisos
Tema 3 Ficheros Y PermisosFresyMetal
 
Tema 6 Cont www.fresymetal.com
Tema 6 Cont www.fresymetal.comTema 6 Cont www.fresymetal.com
Tema 6 Cont www.fresymetal.comFresyMetal
 

Más de FresyMetal (14)

Tema 12 www.fresymetal.com
Tema 12 www.fresymetal.comTema 12 www.fresymetal.com
Tema 12 www.fresymetal.com
 
Tema 11
Tema 11Tema 11
Tema 11
 
Tema 10 www.fresymetal.com
Tema 10 www.fresymetal.comTema 10 www.fresymetal.com
Tema 10 www.fresymetal.com
 
Tema 9 www.fresymetal.com
Tema 9 www.fresymetal.comTema 9 www.fresymetal.com
Tema 9 www.fresymetal.com
 
Tema 7 www.fresymetal.com
Tema 7 www.fresymetal.comTema 7 www.fresymetal.com
Tema 7 www.fresymetal.com
 
Tema 8 www.fresymetal.com
Tema 8 www.fresymetal.comTema 8 www.fresymetal.com
Tema 8 www.fresymetal.com
 
Fpr Tema6 www.fresymetal.com
Fpr Tema6 www.fresymetal.comFpr Tema6 www.fresymetal.com
Fpr Tema6 www.fresymetal.com
 
Fpr Tema 4 www.fresymetal.com
Fpr Tema 4 www.fresymetal.comFpr Tema 4 www.fresymetal.com
Fpr Tema 4 www.fresymetal.com
 
Fpr Tema 3 www.fresymetal.com
Fpr Tema 3 www.fresymetal.comFpr Tema 3 www.fresymetal.com
Fpr Tema 3 www.fresymetal.com
 
Fpr Tema 2 www.fresymetal.com
Fpr Tema 2 www.fresymetal.comFpr Tema 2 www.fresymetal.com
Fpr Tema 2 www.fresymetal.com
 
Fpr Tema 1 www.fresymetal.com
Fpr Tema 1 www.fresymetal.comFpr Tema 1 www.fresymetal.com
Fpr Tema 1 www.fresymetal.com
 
Tema 3 Ficheros Y Permisos
Tema 3 Ficheros Y PermisosTema 3 Ficheros Y Permisos
Tema 3 Ficheros Y Permisos
 
Tema 3 Ficheros Y Permisos
Tema 3 Ficheros Y PermisosTema 3 Ficheros Y Permisos
Tema 3 Ficheros Y Permisos
 
Tema 6 Cont www.fresymetal.com
Tema 6 Cont www.fresymetal.comTema 6 Cont www.fresymetal.com
Tema 6 Cont www.fresymetal.com
 

Fpr Tema 5 www.fresymetal.com

  • 1. Tema 5 Sentencias de control Fundamentos de Programación I.E.S. Juan de Garay
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.