
Ayuda! , separar en silabas con las 10 condiciones
Publicado por Alejandro (2 intervenciones) el 07/12/2014 04:15:58
PRIMERO: estas son las consonantes inseparables (br, bl, cr, cl, dr, fr, fl, gr, gl, kr, ll, pr, pl, tr, rr, ch) aquellas que al separar una palabra estas no se dispersan ej : callar= ca llar (ll), computador = com pu ta dor (mp no es consonante inseparable) , NECECITO UN METODO PARA HALLARLAS EN UN FUNCTION PARA LUEGO PODER LLAMARLA A MI BEGIN END.
SEGUNDO:como puedo eliminar el stack overflow error ? , en la regla numero 7(diptongo) me da este error , encierro uno de los "if" en llaves como un comentario y el programa me corre , pero porsupusto no esta leyendo dicho if . Trate de "duplicar" los functions "va" y "vc" o mejor dicho cree otros nuevos con otros nombres y estos hacian lo mismo que va y vc pero me sigue dando el stack overflow error.
TERCERO:en la regla 9(acentuacion) no me separa la palabra como es , es decir , cuando escribo la palabra mama la separa como : ma ma , pero si introduzco la palabra mamá con acento en la a no separa nada
program separarsilabas;
uses crt;
var
i:integer;
frase:string;
function hache(frase:string):boolean;
var i:integer;
begin
hache:= false;
for i:=1 to length(frase) do
case frase[i] of
'h','H': hache:= true;
end;
end;
function v(frase:string):boolean;
var i:integer;
begin
v:= false;
for i:=1 to length(frase) do
case frase[i] of
'a','e','i','o','u','A','E','i','O','U','y','Y': v:= true;
end;
end;
function va(frase:string):boolean;
var i:integer;
begin
va:= false;
for i:=1 to length(frase) do
case frase[i] of
'a','e','o','A','E','O': va := true;
end;
end;
function vc(frase:string):boolean;
var i:integer;
begin
vc:= false;
for i:=1 to length(frase) do
case frase[i] of
'i','u','I','U','y','Y': vc := true;
end;
end;
function consonante(frase:string):boolean;
var i:integer;
begin
consonante:= false;
for i:=1 to length(frase) do
case frase[i] of {borre h}
'b','c','d','f','g','i','j','k','l','m','n','p','q','r','s','t','v','w','x','z': consonante:= true;
end;
end;
function vcvocacent(frase:string):boolean;
var i:integer;
begin
vcvocacent:= false;
for i:=1 to length(frase) do
case frase[i] of
'¡','£': vcvocacent:= true;
end;
end;
function vavocacent(frase:string):boolean;
var i:integer;
begin
vavocacent:= false;
for i:=1 to length(frase) do
case frase[i] of
' ','‚','¢': vavocacent:= true;
end;
end;
begin
clrscr;
writeln;
writeln('indique la frase u oracion a separar en silabas:');
readln(frase);
{REGLA 3(UNA CONSONANTE ENTRE 2 VOCALES)} {une : u ne}
for i:= 1 to length(frase+frase) do
begin
if (v(frase[i]) = true) and (consonante(frase[i+1])= true ) and (v(frase[i+2]) = true) then
insert (' ',frase,i+1)
else
{REGLA 4(DOS CONSONANTES ENTRE 2 VOCALES)} {agregar condicion cc} {componer : com po ner}
if (v(frase[i]) = true) and (consonante(frase[i+1])= true )
and (consonante (frase[i+2]) = true) and ( v(frase[i+3]) = true) then
insert (' ',frase,i+2)
else
{REGLA 5(TRES CONSONANTES ENTRES 2 VOCALES)} {agregar condicion cc} {transporte : trans por te}
if (v(frase[i]) = true) and (consonante(frase[i+1])= true )
and (consonante (frase[i+2]) = true) and ( consonante(frase[i+3]) = true) and
(v(frase[i+4]) = true) then
insert (' ',frase,i+3)
else
{REGLA 6(INTRODUCCION DE 'H')} {anhelo : an he lo}
if ((v(frase[i]) = true) and (consonante(frase[i+1]) = true)
and (hache(frase[i+2]) = true) and(v(frase[i+3]) = true)) or
((v(frase[i]) = true) and (hache(frase[i+1]) = true)
and (consonante(frase[i+2]) = true) and (v(frase[i+3]) = true)) then
insert (' ',frase,i+2)
else
{REGLA 7(DIPTONGO)} {seleccion : se lec cion}
if ((va(frase[i]) = true) and (vc(frase[i+1])=true) and (consonante(frase[i+2])=true)) or
((vc(frase[i]) = true) and (va(frase[i+1])=true) and (consonante(frase[i+2])=true)) or
((vc(frase[i]) = true) and (vc(frase[i+1])=true) and (consonante(frase[i+2])=true)) or
((va(frase[i]) = true) and (va(frase[i+1])=true) and (consonante(frase[i+2])=true)) then
insert (' ',frase,i+3)
else
{sleccionar : se lec cio nar}
if ((va(frase[i]) = true) and (vc(frase[i+1])=true)
and (consonante(frase[i+2])=true) and (v(frase[i+3]) = true)) or
((vc(frase[i]) = true) and (va(frase[i+1])=true)
and (consonante(frase[i+2])=true) and (v(frase[i+3]) = true)) then
insert (' ',frase,i+4)
else
{ esto hace lo mismo que el de arriba pero con vc+vc y va+va}
if ((vc(frase[i]) = true) and (vc(frase[i+1])=true)
and (consonante(frase[i+2])=true) and (v(frase[i+3]) = true)) or
((va(frase[i]) = true) and (va(frase[i+1])=true)
and (consonante(frase[i+2])=true) and (v(frase[i+3]) = true)) then
insert (' ',frase,i+4)
else
{REGLA 8 (H ENTRE 2 VOCALES)}
if (v(frase[i]) = true) and (hache(frase[i+1]) = true) and (v(frase[i+2]) = true) then
insert(' ',frase,i+3)
else
{REGLA 9(ACENTUACION)} {corregir error ,ej: mari , ma ri }
if ((vavocacent(frase[i]) = true) and (vc(frase[i+1])=true)) or
((vcvocacent(frase[i]) = true) and (va(frase[i+1])=true)) or
((va(frase[i]) = true) and (vcvocacent(frase[i+1])=true)) or
((vc(frase[i]) = true) and (vavocacent(frase[i+1])=true)) or
((vcvocacent(frase[i]) = true) and (vc(frase[i+1])=true)) or
((vc(frase[i]) = true) and (vcvocacent(frase[i+1])=true)) then
insert (' ',frase,i+1)
else
if (vavocacent(frase[i]) = true) and (va(frase[i+1])=true) or
(va(frase[i]) = true) and (vavocacent(frase[i+1])=true) then
insert (' ',frase,i+1)
{ else
{REGLA 10(TRIPTONGO)
if ((vc(frase[i]) = true) and (va(frase[i+1])= true) and (vc(frase[i+2]) = true)) then
insert (' ',frase,i+4);}
end;
writeln;
writeln(frase);
readln;
end.
SEGUNDO:como puedo eliminar el stack overflow error ? , en la regla numero 7(diptongo) me da este error , encierro uno de los "if" en llaves como un comentario y el programa me corre , pero porsupusto no esta leyendo dicho if . Trate de "duplicar" los functions "va" y "vc" o mejor dicho cree otros nuevos con otros nombres y estos hacian lo mismo que va y vc pero me sigue dando el stack overflow error.
TERCERO:en la regla 9(acentuacion) no me separa la palabra como es , es decir , cuando escribo la palabra mama la separa como : ma ma , pero si introduzco la palabra mamá con acento en la a no separa nada
program separarsilabas;
uses crt;
var
i:integer;
frase:string;
function hache(frase:string):boolean;
var i:integer;
begin
hache:= false;
for i:=1 to length(frase) do
case frase[i] of
'h','H': hache:= true;
end;
end;
function v(frase:string):boolean;
var i:integer;
begin
v:= false;
for i:=1 to length(frase) do
case frase[i] of
'a','e','i','o','u','A','E','i','O','U','y','Y': v:= true;
end;
end;
function va(frase:string):boolean;
var i:integer;
begin
va:= false;
for i:=1 to length(frase) do
case frase[i] of
'a','e','o','A','E','O': va := true;
end;
end;
function vc(frase:string):boolean;
var i:integer;
begin
vc:= false;
for i:=1 to length(frase) do
case frase[i] of
'i','u','I','U','y','Y': vc := true;
end;
end;
function consonante(frase:string):boolean;
var i:integer;
begin
consonante:= false;
for i:=1 to length(frase) do
case frase[i] of {borre h}
'b','c','d','f','g','i','j','k','l','m','n','p','q','r','s','t','v','w','x','z': consonante:= true;
end;
end;
function vcvocacent(frase:string):boolean;
var i:integer;
begin
vcvocacent:= false;
for i:=1 to length(frase) do
case frase[i] of
'¡','£': vcvocacent:= true;
end;
end;
function vavocacent(frase:string):boolean;
var i:integer;
begin
vavocacent:= false;
for i:=1 to length(frase) do
case frase[i] of
' ','‚','¢': vavocacent:= true;
end;
end;
begin
clrscr;
writeln;
writeln('indique la frase u oracion a separar en silabas:');
readln(frase);
{REGLA 3(UNA CONSONANTE ENTRE 2 VOCALES)} {une : u ne}
for i:= 1 to length(frase+frase) do
begin
if (v(frase[i]) = true) and (consonante(frase[i+1])= true ) and (v(frase[i+2]) = true) then
insert (' ',frase,i+1)
else
{REGLA 4(DOS CONSONANTES ENTRE 2 VOCALES)} {agregar condicion cc} {componer : com po ner}
if (v(frase[i]) = true) and (consonante(frase[i+1])= true )
and (consonante (frase[i+2]) = true) and ( v(frase[i+3]) = true) then
insert (' ',frase,i+2)
else
{REGLA 5(TRES CONSONANTES ENTRES 2 VOCALES)} {agregar condicion cc} {transporte : trans por te}
if (v(frase[i]) = true) and (consonante(frase[i+1])= true )
and (consonante (frase[i+2]) = true) and ( consonante(frase[i+3]) = true) and
(v(frase[i+4]) = true) then
insert (' ',frase,i+3)
else
{REGLA 6(INTRODUCCION DE 'H')} {anhelo : an he lo}
if ((v(frase[i]) = true) and (consonante(frase[i+1]) = true)
and (hache(frase[i+2]) = true) and(v(frase[i+3]) = true)) or
((v(frase[i]) = true) and (hache(frase[i+1]) = true)
and (consonante(frase[i+2]) = true) and (v(frase[i+3]) = true)) then
insert (' ',frase,i+2)
else
{REGLA 7(DIPTONGO)} {seleccion : se lec cion}
if ((va(frase[i]) = true) and (vc(frase[i+1])=true) and (consonante(frase[i+2])=true)) or
((vc(frase[i]) = true) and (va(frase[i+1])=true) and (consonante(frase[i+2])=true)) or
((vc(frase[i]) = true) and (vc(frase[i+1])=true) and (consonante(frase[i+2])=true)) or
((va(frase[i]) = true) and (va(frase[i+1])=true) and (consonante(frase[i+2])=true)) then
insert (' ',frase,i+3)
else
{sleccionar : se lec cio nar}
if ((va(frase[i]) = true) and (vc(frase[i+1])=true)
and (consonante(frase[i+2])=true) and (v(frase[i+3]) = true)) or
((vc(frase[i]) = true) and (va(frase[i+1])=true)
and (consonante(frase[i+2])=true) and (v(frase[i+3]) = true)) then
insert (' ',frase,i+4)
else
{ esto hace lo mismo que el de arriba pero con vc+vc y va+va}
if ((vc(frase[i]) = true) and (vc(frase[i+1])=true)
and (consonante(frase[i+2])=true) and (v(frase[i+3]) = true)) or
((va(frase[i]) = true) and (va(frase[i+1])=true)
and (consonante(frase[i+2])=true) and (v(frase[i+3]) = true)) then
insert (' ',frase,i+4)
else
{REGLA 8 (H ENTRE 2 VOCALES)}
if (v(frase[i]) = true) and (hache(frase[i+1]) = true) and (v(frase[i+2]) = true) then
insert(' ',frase,i+3)
else
{REGLA 9(ACENTUACION)} {corregir error ,ej: mari , ma ri }
if ((vavocacent(frase[i]) = true) and (vc(frase[i+1])=true)) or
((vcvocacent(frase[i]) = true) and (va(frase[i+1])=true)) or
((va(frase[i]) = true) and (vcvocacent(frase[i+1])=true)) or
((vc(frase[i]) = true) and (vavocacent(frase[i+1])=true)) or
((vcvocacent(frase[i]) = true) and (vc(frase[i+1])=true)) or
((vc(frase[i]) = true) and (vcvocacent(frase[i+1])=true)) then
insert (' ',frase,i+1)
else
if (vavocacent(frase[i]) = true) and (va(frase[i+1])=true) or
(va(frase[i]) = true) and (vavocacent(frase[i+1])=true) then
insert (' ',frase,i+1)
{ else
{REGLA 10(TRIPTONGO)
if ((vc(frase[i]) = true) and (va(frase[i+1])= true) and (vc(frase[i+2]) = true)) then
insert (' ',frase,i+4);}
end;
writeln;
writeln(frase);
readln;
end.
Valora esta pregunta


0