Ayuda!! en pascall xfavorrr!
{te envié el mismo por equivocación mira a ver esto si te ayuda mas lo mando en dos paquetes}
program eleccion;
uses
crt, dos;
type
nombres = record
nombre : string[30];
apell1 : string[30];
apell2 : string[30];
DNI : string[40];
calle : string[50];
ciudad : string[40];
provin : string[40];
nacio : string[10];
codipos : word;
distrito : longint;
end;
candidatos = record
nomb : string[30];
apell1 : string[30];
apell2 : string[30];
DNIC : string[40];
botos : integer;
end;
bota = record
dni : string[40];
bot : boolean;
end;
var
fcan : file of candidatos;
cand : array[1..3] of candidatos;
f : file of nombres;
datos : nombres;
tecla : char;
num, x, y, i, cont : integer;
salvar : boolean;
yy,mm,dd,dww : word;
botan : array[1..50] of bota;
procedure pantalla_datos(d : char);
begin
clrscr;
if d = 'e' then
begin
gotoxy(3,1);write('*** Entrada De Datos *** [ESC] AVANDONAR');
end
else
begin
gotoxy(3,1);write('<<< Informacion >>> [ESC] AVANDONAR');
end;
gotoxy(3,4);write('Nombre : ');
gotoxy(3,6);write('1ø Apellido : ');
gotoxy(3,8);write('2ø Apellido : ');
gotoxy(3,10);write('N§ DNI : ');
gotoxy(3,12);write('Calle : ');
gotoxy(3,14);write('Ciudad : ');
gotoxy(3,16);write('Provincia : ');
gotoxy(3,18);write('Codi.Post. : ');
gotoxy(3,20);write('Distrito : ');
if d = 'e' then
begin
gotoxy(3,22);write('Nacio El : Ejen : 01/02/2011');
end
else
begin
gotoxy(3,22);write('Edad Actual : ')
end;
end;
procedure entrada_datos;
var
anul : boolean;
dat, tec : char;
ent : integer;
entra : string[50];
coposta : word;
error : integer;
begin
x := 16;
y := 4;
gotoxy(x,y);
i := 1;
anul := false;
ent := 1;
dat := 't';
repeat
tec := readkey;
if tec <> #27 then
begin
if dat = 't' then
begin
if tec in[#32,#38..#126,#154,#165] then
begin
entra[ent] := tec;
entra[0] := chr(ent);
gotoxy(x + ent,y);write(entra[ent]);
ent := ent + 1;
if ent > 50 then
ent := 50;
end;
end;
if dat = 'n' then
begin
if tec in[#48..#57] then
begin
entra[ent] := tec;
entra[0] := chr(ent);
gotoxy(x + ent,y);write(entra[ent]);
ent := ent + 1;
if ent > 50 then
ent := 50;
end;
end;
if tec = #8 then
begin
ent := ent - 1;
if ent < 1 then
ent := 1;
entra[ent] := ' ';
entra[0] := chr(ent);
gotoxy(x + ent,y);write(entra[ent]);
end;
if tec = #13 then
begin
case i of
1 : begin
datos.nombre := copy(entra,1,length(entra));
y := y + 2;
ent := 1;
fillchar(entra,51,' ');
entra[0] := chr(50);
dat := 't';
gotoxy(x,y);
end;
2 : begin
datos.apell1 := copy(entra,1,length(entra));
y := y + 2;
ent := 1;
fillchar(entra,51,' ');
entra[0] := chr(50);
dat := 't';
gotoxy(x,y);
end;
3 : begin
datos.apell2 := copy(entra,1,length(entra));
y := y + 2;
ent := 1;
fillchar(entra,51,' ');
entra[0] := chr(50);
dat := 't';
gotoxy(x,y);
end;
4 : begin
datos.DNI := copy(entra,1,length(entra));
y := y + 2;
ent := 1;
fillchar(entra,51,' ');
entra[0] := chr(50);
dat := 't';
gotoxy(x,y);
end;
5 : begin
datos.calle := copy(entra,1,length(entra));
y := y + 2;
ent := 1;
fillchar(entra,51,' ');
entra[0] := chr(50);
dat := 't';
gotoxy(x,y);
end;
6 : begin
datos.ciudad := copy(entra,1,length(entra));
y := y + 2;
ent := 1;
fillchar(entra,51,' ');
entra[0] := chr(50);
dat := 't';
gotoxy(x,y);
end;
7 : begin
datos.provin := copy(entra,1,length(entra));
y := y + 2;
ent := 1;
fillchar(entra,51,' ');
entra[0] := chr(50);
dat := 'n';
gotoxy(x,y);
end;
8 : begin
val(entra,coposta,error);
datos.codipos := coposta;
y := y + 2;
ent := 1;
fillchar(entra,51,' ');
entra[0] := chr(50);
dat := 'n';
gotoxy(x,y);
end;
9 : begin
val(entra,coposta,error);
datos.distrito := coposta;
y := y + 2;
ent := 1;
fillchar(entra,51,' ');
entra[0] := chr(50);
dat := 't';
gotoxy(x,y);
end;
10 : begin
datos.nacio := copy(entra,1,length(entra));
gotoxy(x,y);
end;
end;
i := i + 1;
end;
end
else
begin
anul := true;
end;
until (i > 10) or (anul = true);
if (i > 10) and (anul = false) then
begin
salvar := true;
end
else
begin
salvar := false;
end;
end;
procedure busca_datos;
var
tc : char;
ndni : string[40];
err, zi : integer;
arh : longint;
sal : boolean;
dav : string[4];
fech : word;
begin
gotoxy(3,3);write('N§ DNI : [ESC] AVANDONA');
gotoxy(11,3);
zi := 1;
sal := false;
repeat
tc := readkey;
if tc in[#32,#38..#126,#154,#165] then
begin
ndni[zi] := tc;
ndni[0] := chr(zi);
gotoxy(10 + zi,3);write(ndni[zi]);
zi := zi + 1;
if zi > 40 then
zi := 40;
end;
if tc = #8 then
begin
zi := zi - 1;
if zi < 1 then
zi := 1;
ndni[zi] := ' ';
ndni[0] := chr(zi);
gotoxy(10 + zi,3);write(ndni[zi]);
end;
until (tc = #13) or (tc = #27);
if (tc = #13) and (zi > 2) then
begin
assign(f,'c:\VaseDato.bsd');
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
clrscr;
writeln('Falta El Archivo VaseDato.bsd');
writeln;
writeln('Pulse Enter');
repeat
tc := readkey;
until tc = #13;
end
else
begin
arh := 0;
repeat
seek(f,arh);
read(f,datos);
if datos.dni = ndni then
begin
sal := true;
end;
arh := arh + 1;
until (sal = true) or (arh > filesize(f) - 1);
if sal = true then
begin
y := 4;
clrscr;
pantalla_datos(' ');
gotoxy(16,y);write(datos.nombre);
y := y + 2;
gotoxy(16,y);write(datos.apell1);
y := y + 2;
gotoxy(16,y);write(datos.apell2);
y := y + 2;
gotoxy(16,y);write(datos.dni);
y := y + 2;
gotoxy(16,y);write(datos.calle);
y := y + 2;
gotoxy(16,y);write(datos.ciudad);
y := y + 2;
gotoxy(16,y);write(datos.provin);
y := y + 2;
gotoxy(16,y);write(datos.codipos);
y := y + 2;
gotoxy(16,y);write(datos.distrito);
y := y + 2;
GetDate(yy,mm,dd,dww);
dav := copy(datos.nacio,(length(datos.nacio) - 3),length(datos.nacio) + 1);
val(dav,fech,err);
gotoxy(16,y);write((yy - fech));
gotoxy(3,y + 3);write('PULSE ENTER');
repeat
tc := readkey;
until tc = #13;
end
else
begin
clrscr;
writeln;
writeln('El DNI No Esta En La Vase ');
writeln('--- [Pulse Enter] ---');
repeat
tc := readkey;
until tc = #13;
end;
end;
end;
end;
procedure panta_menu;
begin
gotoxy(1,1);write('*** MENU GENERAL ***');
gotoxy(4,3);write(' 1 Entrada Datos');
gotoxy(4,5);write(' 2 Comparar Datos');
gotoxy(4,7);write(' 3 Entrada Candidatos');
gotoxy(4,9);write(' 4 Elecion Candidato');
gotoxy(4,11);write(' 5 Salir');
gotoxy(4,13);write('<< Elija Opcion >>');
end;
procedure entra_candidatos;
var
datocon : string[40];
tdc : char;
candi, com, ni : integer;
borra, posx, posy : integer;
fin : boolean;
begin
clrscr;
gotoxy(3,1);write(' *** Candidatos ***');
gotoxy(3,3);write('Nombre : ');
gotoxy(3,5);write('1§ Apellido : ');
gotoxy(3,7);write('2§ Apellido : ');
gotoxy(3,9);write('N§ DNI : ');
gotoxy(3,11);write('Entre Datos [ESC] Avandobar');
posx := 16;
posy := 3;
gotoxy(posx,posy);
ni := 1;
com := 1;
fin := false;
fillchar(datocon,41,' ');
datocon[0] := chr(40);
candi := 1;
repeat
gotoxy(posx,posy);
repeat
tdc := readkey;
if tdc in[#32,#38..#126,#154,#165] then
begin
datocon[ni] := tdc;
datocon[0] := chr(ni);
gotoxy(posx + ni,posy);write(datocon[ni]);
ni := ni + 1;
if ni > 40 then
ni := 40;
end;
if tdc = #8 then
begin
ni := ni - 1;
if ni < 1 then
ni := 1;
datocon[ni] := ' ';
datocon[0] := chr(ni);
gotoxy(posx + ni,posy);write(datocon[ni]);
end;
if tdc = #13 then
begin
case com of
1 : begin
cand[candi].nomb := copy(datocon,1,length(datocon));
posy := posy + 2;
fillchar(datocon,41,' ');
datocon[0] := chr(40);
ni := 1;
com := com + 1;
gotoxy(posx,posy);
end;
2 : begin
cand[candi].apell1 := copy(datocon,1,length(datocon));
posy := posy + 2;
fillchar(datocon,41,' ');
datocon[0] := chr(40);
ni := 1;
com := com + 1;
gotoxy(posx,posy);
end;
3 : begin
cand[candi].apell2 := copy(datocon,1,length(datocon));
posy := posy + 2;
fillchar(datocon,41,' ');
datocon[0] := chr(40);
ni := 1;
com := com + 1;
gotoxy(posx,posy);
end;
4 : begin
cand[candi].DNIC := copy(datocon,1,length(datocon));
fin := true;
com := com + 1;
fin := true;
end;
end;
end;
until (com > 4) or (tdc = #27);
if (com > 4) and (fin = true) then
begin
assign(fcan,'c:\Candidat.cdt');
{$I-} reset(fcan); {$I+}
if ioresult <> 0 then
begin
rewrite(fcan);
seek(fcan,0);
write(fcan,cand[candi]);
close(fcan);
end
else
begin
seek(fcan,filesize(fcan));
write(fcan,cand[candi]);
close(fcan);
end;
end;
borra := 1;
repeat
gotoxy(16,borra);clreol;
borra := borra + 2;
until borra > 9;
candi := candi + 1;
fin := false;
until (candi > 3) or (tdc = #27);
end;