Pascal/Turbo Pascal - Entre matrices

 
Vista:

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.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Entre matrices

Publicado por carlos (2 intervenciones) el 14/01/2007 17:53:09
a ver si te ayuda, no serás de la FIC no??

si pudieses ayudarme a leer una matriz desde un archivo te lo agradecería

function leeColumnas(var f: tfTexto; var n: integer): integer;
var
dim: integer value 1;
begin
reset(f);
gotoln(f,n); {procedimiento que va a la linea n en el fichero f}
repeat
if f^ in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.']
then get(f)
else begin
dim := dim + 1;
get(f);
end;
until eoln(f);
leeColumnas := dim;
end;
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar