Presentation is loading. Please wait.

Presentation is loading. Please wait.

Resolución de problemas y algoritmos

Similar presentations


Presentation on theme: "Resolución de problemas y algoritmos"— Presentation transcript:

1 Resolución de problemas y algoritmos
Dra. Jessica Andrea Carballido Dpto. de Ciencias e Ingeniería de la Computación UNIVERSIDAD NACIONAL DEL SUR

2 Problema: Dada una secuencia S de caracteres (finalizada en punto), mostrar las vocales en el orden que aparecen, y luego las consonantes invertidas. Entre las vocales y las consonantes debe mostrar un asterisco. Mostrar vocales y consonantes de S Caso Base: Si S es un punto, mostrar un *. Caso Recursivo: Si S tiene más de un elemento; si el 1er elemento de S es una vocal, mostrarla y luego Mostrar vocales y consonantes de S’, si el 1er elemento de S es una consonante, Mostrar vocales y consonantes de S’ y luego mostrar la consonante, en otro caso Mostrar vocales y consonantes de S’. Donde S’ es S sin su primer elemento.

3 procedure mostrarVyC;
var ch: char; begin read(ch); if ch='.‘ then write(' * ') else if esVocal(ch) then begin write(ch); mostrarVyC; end if esLetra(ch) // es consonante ya que es letra y no es vocal then begin end;

4 E s t a ? . E s t a ? . Buffer ch program InversionParcial;
procedure mostrarVyC; begin writeln(‘Ingrese una secuencia finalizando en .’); mostrarVyC; end. Ingrese una secuencia finalizando en . procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch E s t a ? . E s t a ? . Buffer

5 E s t a ? . E s t a ? . Buffer ch ch procedure mostrarVyC;
var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; Ingrese una secuencia finalizando en . ch ch procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; E s t a ? . E s t a ? . Buffer

6 E s t a ? . E s t a ? . Buffer ch ch ch
Ingrese una secuencia finalizando en . procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch ch ch procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; E s t a ? . E s t a ? . Buffer

7 E s t a ? . E s t a ? . Buffer ch ch ch ch
Ingrese una secuencia finalizando en . procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch ch ch procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch E s t a ? . E s t a ? . Buffer

8 E s t a ? . E s t a ? . Buffer ch ch ch ch ch
Ingrese una secuencia finalizando en . procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch ch ch procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch ch E s t a ? . E s t a ? . Buffer

9 E s t a ? . E s t a ? . Buffer ch ch ch ch ch ch
Ingrese una secuencia finalizando en . procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch ch ch procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch ch ch E s t a ? . E s t a ? . Buffer

10 E s t a ? . Buffer ch ch ch ch ch
Ingrese una secuencia finalizando en . procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch ch ch ch ch E s t a ? . Buffer

11 E s t a ? . Buffer ch ch ch ch ch
Ingrese una secuencia finalizando en . procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch ch ch procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch ch E s t a ? . Buffer

12 E s t a ? . Buffer ch ch ch ch Ingrese una secuencia finalizando en .
procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch ch ch procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch E s t a ? . Buffer

13 E s t a ? . Buffer ch ch ch Ingrese una secuencia finalizando en .
procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch ch ch procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; E s t a ? . Buffer

14 E s t a ? . Buffer ch ch procedure mostrarVyC; var ch: char;
begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; Ingrese una secuencia finalizando en . ch ch procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; E s t a ? . Buffer

15 E s t a ? . Buffer ch program InversionParcial; procedure mostrarVyC;
begin writeln(‘Ingrese una secuencia finalizando en .’); mostrarVyC; end. Ingrese una secuencia finalizando en . procedure mostrarVyC; var ch: char; begin read(ch); if ch='.‘ then write(' * ') else begin if esVocal(ch) then begin write(ch); mostrarVyC; end else if esLetra(ch) then begin mostrarVyC; write(ch); end else mostrarVyC; end; ch E s t a ? . Buffer


Download ppt "Resolución de problemas y algoritmos"

Similar presentations


Ads by Google