Entre matrices
Publicado por Juan (1 intervención) el 13/01/2007 11:52:18
Hola
Tengo el siguiente archivo de texto:
123 234
233 333
455 666
55 99
Como puedo hacer para contar los espacios que hay entre cada matriz (es decir entre el 233 333 y el 455 666 por ejemplo)? Ya he intentado de muchas formas, pero ninguna me sale correctamente.
texto: string
El resto son integers, salvo Fichero claro.
While not Eof (Fichero) do
begin
while not Eoln (Fichero) do
begin
Read (Fichero,texto);
N_texto:=length(texto);
for o:=1 to N_texto do
begin
if texto[o] = chr(32) then i:=i+1; //aqui lee los espacios entre los numeros
writeln(N_texto,o,'texto: ',texto[o]);// simple comprovacion
//texto:=trim(texto);
if trim(texto[o])= ' ' then u:=u+1;// aqui deberia contarme los intros, pero no lo hace. Tan bien he probado solo con texto y con el length pero el resultado es igualmente malo.
end;
if texto = '' then u:=1;
end;
if length(trim(texto[1]))= 0 then u:=u+1;
Writeln;
Readln(Fichero)
end;
Si me podeis ayudar os lo agradeceria.
Muchas gracias.
Tengo el siguiente archivo de texto:
123 234
233 333
455 666
55 99
Como puedo hacer para contar los espacios que hay entre cada matriz (es decir entre el 233 333 y el 455 666 por ejemplo)? Ya he intentado de muchas formas, pero ninguna me sale correctamente.
texto: string
El resto son integers, salvo Fichero claro.
While not Eof (Fichero) do
begin
while not Eoln (Fichero) do
begin
Read (Fichero,texto);
N_texto:=length(texto);
for o:=1 to N_texto do
begin
if texto[o] = chr(32) then i:=i+1; //aqui lee los espacios entre los numeros
writeln(N_texto,o,'texto: ',texto[o]);// simple comprovacion
//texto:=trim(texto);
if trim(texto[o])= ' ' then u:=u+1;// aqui deberia contarme los intros, pero no lo hace. Tan bien he probado solo con texto y con el length pero el resultado es igualmente malo.
end;
if texto = '' then u:=1;
end;
if length(trim(texto[1]))= 0 then u:=u+1;
Writeln;
Readln(Fichero)
end;
Si me podeis ayudar os lo agradeceria.
Muchas gracias.
Valora esta pregunta


0