Pascal/Turbo Pascal - FICHEROS SECUENCIALES

 
Vista:

FICHEROS SECUENCIALES

Publicado por carlos (12 intervenciones) el 18/04/2012 16:51:32
Hola, tengo que hacer un programa que lea una línea de texto de longitud indeterminada (puede ocupar mas de una línea) introducido por el teclado y que termina con el símbolo *, y contar el número de palabras, letras y vocales que contiene el texto introducido y mostrar los resultados por pantalla. (se supone que tengo que usar ficheros secuenciales). El problema es que los acabamos de dar y no me aclaro. Me podriais echar un cable??
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

FICHEROS SECUENCIALES

Publicado por ramon (2158 intervenciones) el 18/04/2012 21:34:43
{Este programa te puede ayudar}

program textos;
uses
crt;
var
dato : string[80];
f : text;
nombre : string;

procedure entrada_texto;
begin
gotoxy(10,1);write('Entre Nombre Archivo [8] Letras : ');
gotoxy(44,1);readln(nombre);
assign(f,nombre + '.txt');
{$I-} reset(f); {$I+}
if ioresult = 0 then
begin
writeln('EL ARCHIVO NOMBRE : ',nombre,'.txt Ya Esiste pulse [ENTER]');
readln;
end
else
begin
clrscr;
rewrite(f);
gotoxy(3,1);write('*** EDITOR ARCHIVOS DE TEXTO TERMINA ENTRANDO [ESPACIO y RETUR] ****');
gotoxy(3,2);write('---------------------------------------------------------------------');
window(1,3,79,24);
gotoxy(1,1);
repeat
readln(dato);
if dato <> ' ' then
writeln(f,dato);
until dato = ' ';
close(f);
window(1,1,80,25);
end;
end;

procedure leer_archivo_txt;
var
pu, car : char;
n : integer;
begin
gotoxy(10,1);write('Entre Nombre Archivo [8] Letras : ');
gotoxy(44,1);readln(nombre);
assign(f,nombre + '.txt');
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
clrscr;
writeln('EL ARCHIVO NOMBRE : ',nombre,' NO ESTA PULSE [ENTER]');
readln;
end
else
begin
clrscr;
gotoxy(10,1);write('Contenido Del Archivo Nombre : ',nombre);
gotoxy(10,2);write('---------------------------------------------');
n := 0;
window(2,3,79,24);
while not Eof(F) do
begin
Read(f, Car);
Write(Car);
if car = #10 then
n := n + 1;
if n > 21 then
begin
n := 0;
textcolor(12);
gotoxy(1,24);write('Pulse [ ',chr(25),' ]');
textcolor(15);
repeat
pu := readkey;
until pu = #80;
clrscr;
end;
end;
writeln;
textcolor(12);
gotoxy(2,17);write('Final Archivo Pulsa [Enter]');
textcolor(15);
readln;
close(f);
window(1,1,80,25);
clrscr;
end;
end;

procedure menu;
var
sal : boolean;
tecla : char;
begin
sal := false;
repeat
clrscr;
gotoxy(2,2);write('**** Menu General ****');
gotoxy(2,4);write(' 1 = Entrada texto');
gotoxy(2,5);write(' 2 = Ver archivo texto');
gotoxy(2,6);write(' 3 = Salir');
gotoxy(2,8);write('<<< Elija Opcion >>>');
tecla := readkey;
clrscr;
case tecla of
#49 : entrada_texto;
#50 : leer_archivo_txt;
#51 : sal := true;
end;
until sal = true;
end;

begin
clrscr;
menu;
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