Diccionario
Program Diccionario;
Type
Str=String;
RegPalabra=Record
Palabra,definicion:str;
end;
ArchPalabra=file of RegPalabra;
Function BusBin(var Arch:ArchPalabra;Palabra:str):longint;
var pos:longint;
RPalabra:RegPalabra;
Pri,ult,med:word;
Begin
Pri:=0;
Ult:=filesize(Arch)-1;
Pos:=-1;
while((pri 65 then
begin
y := y + 1;
x := 4;
end;
end;
if tecla = #8 then
begin
i := i - 1;
if i < 1 then
i := 1;
x := x - 1;
datext[i] := ' ';
datext[0] := chr(i);
gotoxy(x,y);write(datext[i]);
end;
until tecla = #13;
entradadatos := copy(datext,1,length(datext));
end;
function entradaread(d : char) : string;
var
long, i, x, y : integer;
datext : string;
begin
if (d = 'p') or (d= 'P') then
begin
gotoxy(4,4);write('Entre Palabra : ');
x := 19;
y := 4;
long := 20;
end;
if (d = 's') or (d = 'S') then
begin
gotoxy(4,5);write('Entre Significado : ');
x := 24;
y := 5;
long := 255;
end;
readln(datext);
if length(datext) > long then
entradaread := copy(datext,1,long)
else
entradaread := copy(datext,1,length(datext));
end;
procedure entradasdiccionario;
varsalir : boolean;
tec : char;
sa : integer;
begin
cont := 1;
salir := false;
repeat
gotoxy(2,2);write('Entrada datos al Diccionario [Enter Final Entrada]');
dicci[cont].palabra := entradadatos('p'); {entradaread('p');}
dicci[cont].significado := entradadatos('s'); {entradaread('s');}
gotoxy(4,10);write('Desea Entrar mas Datos [S/N]');
repeat
tec := readkey;
until tecin['s','S','n','N'];
if tec in['n','N'] then
salir := true
else
begin
salir := false;
cont := cont + 1;
if cont > 100 then
begin
assign(fdic,'dicciona.dic');
{$I-} reset(fdic); {$I+}
if ioresult 0 then
begin
rewrite(fdic);
for sa := 1 to cont do
begin
seek(fdic,sa - 1);
write(fdic,dicci[sa]);
end;
close(fdic);
cont := 1;
end
else
begin
for sa := 1 to cont do
beginseek(fdic,filesize(fdic) + sa - 1);
write(fdic,dicci[sa]);
end;
close(fdic);
cont := 1;
end;
end;
end;
clrscr;
until salir = true;
gotoxy(4,10);write('Desea Guardar los Datos [S/N]');
repeat
tec := readkey;
until tec in['s','S','n','N'];
if tec in['s','S'] then
begin
assign(fdic,'dicciona.dic');
{$I-} reset(fdic); {$I+}
if ioresult 0 then
begin
rewrite(fdic);
for sa := 1 to cont do
beginseek(fdic,sa - 1);
write(fdic,dicci[sa]);
end;
close(fdic);
cont := 1;
end
else
begin
for sa := 1 to cont do
begin
seek(fdic,filesize(fdic) + sa - 1);
write(fdic,dicci[sa]);
end;
close(fdic);
cont := 1;
end;
end;
end;
procedure buscarpalabra;
var
palab : string[20];
tama, i : longint;
encont : boolean;
tt : char;
begin
clrscr;
gotoxy(4,2);write('Busqueda Palabra');gotoxy(4,5);write('Palabra : ');
gotoxy(14,5);readln(palab);
if length(palab) > 20 then
delete(palab,20,length(palab));
assign(fdic,'dicciona.dic');
{$I-} reset(fdic); {$I+}
if ioresult 0 then
begin
writeln('Archivo < diccona.dic > no Encontrado');
exit;
end
else
begin
tama := filesize(fdic) - 1;
i := 0;
encont := false;
repeat
seek(fdic,i);
read(fdic,dicci[1]);
if dicci[1].palabra =palab then
encont := true;
i := i + 1;
until (i > tama) or (encont = true);
if encont = true then
begin
clrscr;
gotoxy(4,2);write('La Palabra Fue [ ',palab,' ]');
gotoxy(4,4);write(dicci[1].palabra);
gotoxy(4,5);write(dicci[1].significado);
gotoxy(4,8);write('>');
repeat
tt := readkey;
until tt = #13;
end;
end;
close(fdic);
end;
procedure verdicionario;
var
puls : char;
iv,...
Regístrate para leer el documento completo.