Pascal/Turbo Pascal - Necsito meter esto dentro de archivos URGENTE PARA MAÑANA.POR FAVOR AYUDENME!!

 
Vista:

Necsito meter esto dentro de archivos URGENTE PARA MAÑANA.POR FAVOR AYUDENME!!

Publicado por dani gonzalez (9 intervenciones) el 07/02/2012 02:31:56
program banco_uneg;
uses
crt;

type

cliente = record
cedula : integer;
nombre : string[12];
apellido1 : string[12];
direccion : string[50];
telefono : string[12];
codigo1 : string[6];
cta_aho : string[20];
cta_cte : string[20];
bs_aho : real;
bs_cte : real
end;

var
cuenta : cliente;

procedure Registrar_nuevo_cliente;
var
codigo : string[6];
begin
gotoxy(12,2);write('*** Registrar_nuevo_cliente ***');
gotoxy(12,4);write('Entre Codigo Nuevo Cliente : ');
gotoxy(41,4);readln(codigo);
{aki va un for para recorrer todos los archivos}
if (codigo = cuenta.codigo1) then
begin
gotoxy(12,4);writeln('Este codigo ya se encuentra registrado ');
readkey;
clrscr
end
else
begin
clrscr;
cuenta.codigo1:=codigo;
gotoxy(12,2);write('*** Registrar_nuevo_cliente ***');
gotoxy(12,5);write('Cedula : ');
gotoxy(12,6);write('Nombre : ');
gotoxy(12,7);write('Apellido : ');
gotoxy(12,8);write('Direccion : ');
gotoxy(12,9);write('Telefono : ');
gotoxy(12,10);write('Codigo : ');
gotoxy(26,5);readln(cuenta.cedula);
gotoxy(26,6);readln(cuenta.nombre);
gotoxy(26,7);readln(cuenta.apellido1);
gotoxy(26,8);readln(cuenta.direccion);
gotoxy(26,9);readln(cuenta.telefono);
gotoxy(26,10);writeln(cuenta.codigo1);
writeln;
readkey;
clrscr;
end;
end;
procedure retiro_deposito_saldo;
var
valor,aux : real;
opc : char;
cta : char;
sw : boolean;
begin
sw:=true;
valor:=0.00;
while (sw = true) do
begin
clrscr;
gotoxy(3,2);writeln ('opc 1. depositar');
gotoxy(3,3);writeln ('opc 2. retirar');
gotoxy(3,4);writeln ('opc 3. consultar');
gotoxy(3,5);writeln ('opc 4. salir');
opc := readkey;
clrscr;
case opc of
'1':repeat
clrscr;
gotoxy(3,3);writeln('1.CUENTA DE AHORRO');
gotoxy(3,4);writeln('2.CUENTA CORRIENTE');
gotoxy(3,5);cta:=readkey;
clrscr;
if (cta = '1') then
if (cuenta.cta_aho =' ') then
begin
gotoxy(3,4);writeln('Ud no posee una cuenta de ahorro');
readkey;
clrscr
end
else
begin
gotoxy(3,3);writeln ('introduzca el monto');
gotoxy(3,5);read (aux);
clrscr;
if (aux > 0) THEN
cuenta.bs_aho:=cuenta.bs_aho + aux
else
gotoxy(3,4);writeln ('monto invalido');
clrscr;
end
else
if (cta = '2') then
if (cuenta.cta_cte =' ') then
begin
gotoxy(3,4);writeln('Ud no posee una cuenta corriente');
readkey;
clrscr
end
else
begin
gotoxy(3,3);writeln ('introduzca el monto');
gotoxy(3,4);read (aux);
clrscr;
if (aux > 0) THEN
cuenta.bs_cte:=cuenta.bs_cte + aux
else
begin
gotoxy(3,4);writeln ('monto invalido');
clrscr;
end
end;
if (cta<>'1')and(cta<>'2') then
begin
clrscr;
gotoxy(3,5);writeln('Opcion invalida. Intente de nuevo');
readkey;
clrscr
end
until (cta='1')or(cta='2');
'2':repeat
clrscr;
gotoxy(3,3);writeln('1.CUENTA DE AHORRO');
gotoxy(3,4);writeln('2.CUENTA CORRIENTE');
gotoxy(3,5);cta:=readkey;
clrscr;
if (cta = '1') then
if (cuenta.cta_aho =' ') then
begin
gotoxy(12,3);writeln('Ud no posee una cuenta de ahorro');
readkey;
clrscr
end
else
begin
gotoxy(12,3);writeln ('introduzca monto a retirar');
gotoxy(12,4);read (aux);
if (aux > cuenta.bs_aho) then
begin
gotoxy(12,5);writeln('No posee saldo suficiente para realizar esta transaccion');
readkey;
clrscr
end
else
if (cuenta.bs_aho=valor) then
begin
gotoxy(12,5);writeln('Saldo Insuficiente, Ud posee un saldo de: ', cuenta.bs_aho:2:2);
readkey;
clrscr
end
else
if (cuenta.bs_aho >= aux) then
cuenta.bs_aho := cuenta.bs_aho - aux
else
gotoxy(3,4);write ('monto invalido');
clrscr
end
else
if (cta = '2') then
if (cuenta.cta_cte =' ') then
begin
gotoxy(12,3);writeln('Ud no posee una cuenta corriente');
readkey;
clrscr
end
else
begin
gotoxy(12,3);writeln ('introduzca monto a retirar');
gotoxy(12,5);readln (aux);
if (cuenta.bs_cte=valor) then
begin
gotoxy(12,5);writeln('Saldo Insuficiente, Ud posee un saldo de: ', cuenta.bs_cte:2:2);
readkey;
clrscr
end
else
if (cuenta.bs_cte >= aux) then
cuenta.bs_cte := cuenta.bs_cte - aux
else
gotoxy(3,4);write ('monto invalido');
clrscr
end;
if (cta<>'1')and(cta<>'2') then
begin
clrscr;
gotoxy(3,5);writeln('Opcion invalida. Intente de nuevo');
readkey;
clrscr
end
until (cta='1')or(cta='2');
'3':repeat
clrscr;
gotoxy(3,3);writeln('1.CUENTA DE AHORRO');
gotoxy(3,4);writeln('2.CUENTA CORRIENTE');
gotoxy(3,5);cta:=readkey;
clrscr;
if (cta = '1') then
if (cuenta.cta_aho =' ') then
begin
gotoxy(12,3);writeln('Ud no posee una cuenta de ahorro');
readkey;
clrscr
end
else
begin
gotoxy(12,3);writeln ('el saldo es ',cuenta.bs_aho:2:2,'Bs');
writeln;
readkey;
clrscr
end
else
if (cta = '2') then
if (cuenta.cta_cte =' ') then
begin
gotoxy(12,3);writeln('Ud no posee una cuenta corriente');
readkey;
clrscr
end
else
begin
gotoxy(12,3);writeln ('el saldo es ',cuenta.bs_cte:2:2,'Bs');
writeln;
readkey;
clrscr
end;
if (cta<>'1')and(cta<>'2') then
begin
clrscr;
gotoxy(3,5);writeln('Opcion invalida. Intente de nuevo');
readkey;
clrscr
end
until (cta='1')or(cta='2');
'4': sw := false
else
begin
gotoxy(12,5);writeln ('opcion invalida');
end
end;
end;
clrscr;
end;

procedure Abrir_una_cuenta;
var
codigo : string[6];
r : char; //hay q agregar archivo para poder hacerlo con varios clientes
cta : char;
begin
clrscr;
cta:=' ';
cuenta.cta_aho:=' ';
cuenta.cta_cte:=' ';
writeln('*** Abrir_una_cuenta ***');
writeln;
gotoxy(5,4);writeln('Introduzca codigo de cliente');
gotoxy(5,5);readln(codigo);
clrscr;
if (codigo = cuenta.codigo1) then
repeat
gotoxy(3,3);writeln('1.para cuenta de ahorro');
gotoxy(3,4);writeln('2.para cuenta corriente');
gotoxy(3,6);cta:=readkey;
case cta of
'1':begin
clrscr;
if (cuenta.cta_aho=' ') then
begin
gotoxy(3,3);writeln('asigne numero de cuenta');
gotoxy(3,5);readln(cuenta.cta_aho);
readkey;
clrscr
end
else
begin
gotoxy(3,3);writeln('Usted ya posee una cuenta de este tipo');
readkey;
clrscr
end
end;
'2':begin
clrscr;
if (cuenta.cta_cte=' ') then
begin
gotoxy(3,3);writeln('asigne numero de cuenta');
gotoxy(3,5);readln(cuenta.cta_cte);
readkey;
clrscr
end
else
begin
gotoxy(3,3);writeln('Usted ya posee una cuenta de este tipo');
readkey;
clrscr
end;
end;
else
begin
clrscr;
gotoxy(12,4);writeln('opcion invalida, intente de nuevo')
end;
end;
gotoxy(12,5);writeln('desea abrir una nueva cuenta? [S/N]');
gotoxy(12,7);readln(r);
clrscr;
until (upcase(r)='N')
else
begin
gotoxy(12,3);writeln('cliente no encontrado');
readkey;
clrscr
end;
readln;
end;

procedure Cerrar_una_cuenta;
var
cta : string[20];
valor : real; {prueba}
begin
valor:=0.00;
clrscr;
writeln('*** Cerrar_una_cuenta ***');
gotoxy(3,3);writeln('cual es su numero de cuenta?');
gotoxy(3,4);readln(cta);
{aki va el for desd i hasta N, falta archivo}
if (cta = cuenta.cta_aho) then
if (cuenta.bs_aho > valor) then {prueba valor}
begin
clrscr;
gotoxy(3,3);writeln(' usted tiene un saldo de ',cuenta.bs_aho:2:2,'Bs espere su dinero');
cuenta.bs_aho:=0;
readkey;
clrscr;
gotoxy(3,3);writeln(' Su cuenta fue CERRADA exitosamente');
readkey;
clrscr
end
else
begin
gotoxy(3,3);writeln(' esta cuenta NO existe');readkey;clrscr
end
else
if (cuenta.bs_cte > valor) then {prueba valor}
begin
clrscr;
gotoxy(12,3);writeln('usted tiene un saldo de ',cuenta.bs_cte:2:3,'Bs espere su dinero');
cuenta.bs_cte:=0;
readkey;
clrscr;
gotoxy(12,3);writeln('Su cuenta fue CERRADA exitosamente');
readkey;
clrscr
end
else
begin
gotoxy(12,3);writeln('esta cuenta NO existe');readkey
end;
clrscr;
end;

procedure Consultar_estado_cuenta;
var
codigo : string[6];
cta : char;
begin
clrscr;
writeln('*** Consultar_estado_cuenta ***');
{for para buscar archivo por archivo}
{no estoy segura si este va aki, puede ser q vaya en el procedimiento de
abajo, pero, a mi parecer pidn lo mismo}
gotoxy(3,3);writeln('ingrese codigo cliente');
gotoxy(3,4);readln(codigo);
clrscr;
if (codigo = cuenta.codigo1) then
begin
gotoxy(3,3);writeln('1. INFORMACION CUENTA DE AHORRO');
gotoxy(3,4);writeln('2. INFORMACION CUENTA CORRIENTE');
gotoxy(3,5);cta:=readkey;
clrscr;
case cta of
'1' : if (cuenta.cta_aho = ' ')then
begin
gotoxy(3,3);writeln ('Ud no posee una cuenta de ahorro');
readkey;
clrscr
end
else
begin
gotoxy(3,3);writeln('Nombre : ',cuenta.nombre);
gotoxy(3,4);writeln('Apellido : ',cuenta.apellido1);
gotoxy(3,5);writeln('Saldo de su cuenta:',cuenta.bs_aho:2:2);
readkey;
clrscr
end;
'2' : if (cuenta.cta_cte = ' ')then
begin
writeln;
gotoxy(12,3);writeln ('Ud no posee una cuenta corriente');
readkey;
clrscr
end
else
begin
gotoxy(3,3);writeln('Nombre : ',cuenta.nombre);
gotoxy(3,4);writeln('Apellido : ',cuenta.apellido1);
gotoxy(3,5);writeln('Saldo de su cuenta:',cuenta.bs_cte:2:2);
readkey;
clrscr
end;
else
begin
gotoxy(12,3);writeln('Opcion Invalida');
readkey;
clrscr
end;
end;
end;
clrscr;
end;
{YA SUBO LA CONTINUACION}
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

Necsito meter esto dentro de archivos URGENTE PARA MAÑANA.POR FAVOR AYUDENME!!

Publicado por dani gonzalez (9 intervenciones) el 07/02/2012 02:32:57
{CONTINUACION}
procedure Consultar_datos_cliente;
var
codigo : string[6];
begin
clrscr;
writeln('*** Consultar_datos_cliente ***');
{for para buscar archivo por archivo}
{no estoy segura si este va aki, puede ser q vaya en el procedimiento de
abajo, pero, a mi parecer pidn lo mismo}
gotoxy(3,3);writeln('ingrese codigo cliente');
gotoxy(3,4);readln(codigo);
clrscr;
if (codigo = cuenta.codigo1) then
begin
gotoxy(3,3);writeln('Cedula: ',cuenta.cedula);
writeln;
gotoxy(3,5);writeln('Nombre: ',cuenta.nombre);
writeln;
gotoxy(3,7);writeln('Apellido: ',cuenta.apellido1);
writeln;
gotoxy(3,9);writeln('Direccion: ',cuenta.direccion);
writeln;
gotoxy(3,11);writeln('Telefono : ',cuenta.telefono);
writeln;
gotoxy(3,13);writeln('Codigo: ',cuenta.codigo1);
writeln;
gotoxy(3,15);writeln('Numero de cuenta de ahorro: ',cuenta.cta_aho);
writeln;
gotoxy(3,17);writeln('Numero de cuenta corriente: ',cuenta.cta_cte);
writeln;
gotoxy(3,19);writeln('Saldo cta de ahorro: ',cuenta.bs_aho:2:2);
writeln;
gotoxy(3,21);writeln('Saldo cta corriente: ',cuenta.bs_cte:2:2);
writeln;
readkey;
end;

writeln('<<<< Pulse Enter >>>>');
readkey;
clrscr;
end;


procedure marcador(px, py : integer; estado : boolean);
begin
if estado = true then
begin
gotoxy(px - 1,py - 1);write('--------------------------------');
gotoxy(px - 2,py);write('|');
gotoxy(px + 31,py);write('|');
gotoxy(px - 1,py + 1);write('--------------------------------');
end
else
begin
gotoxy(px - 1,py - 1);write(' ');
gotoxy(px - 2,py);write(' ');
gotoxy(px + 31,py);write(' ');
gotoxy(px - 1,py + 1);write(' ');
clrscr
end;
end;
procedure menu;
var
opcion : integer;
tecmen : char;
salir : boolean;
x, y : integer;
begin
opcion := 1;
salir := false;
x := 5;
y := 5;
repeat
gotoxy(5,2);write('$$$$$$ Banco Universitario de Guayana $$$$$$');
gotoxy(5,5);write('Registrar nuevo cliente');
gotoxy(5,7);write('Abrir cuenta');
gotoxy(5,9);write('realizar operacion');
gotoxy(5,11);write('Consultar estado cuenta');
gotoxy(5,13);write('Consultar datos cliente');
gotoxy(5,15);write('Cerrar una cuenta');
gotoxy(5,17);write('Salir');
gotoxy(5,22);write('Use Las Teclas De [',chr(24),chr(25),'] y Enter');
marcador(x,y,true);
tecmen := readkey;
marcador(x,y,false);
if tecmen = #72 then
begin
opcion := opcion - 1;
if opcion < 1 then
opcion := 1;
y := y - 2;
if y < 5 then
y := y + 2;
end;
if tecmen = #80 then
begin
opcion := opcion + 1;
if opcion > 7 then
opcion := 7;
y := y + 2;
if y > 5 + 12 then
y := y - 2;
end;
if tecmen = #13 then
begin
case opcion of
1 : Registrar_nuevo_cliente;
2 : Abrir_una_cuenta;
3 : retiro_deposito_saldo;
4 : Consultar_estado_cuenta;
5 : Consultar_datos_cliente;
6 : Cerrar_una_cuenta;
7 : salir := true;
end;
end;
until salir = 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

Necsito meter esto dentro de archivos URGENTE PARA MAÑANA.POR FAVOR AYUDENME!!

Publicado por ramon (2158 intervenciones) el 07/02/2012 16:47:29
{Algo de esto quieres}
var
archivo : file of cliente;

procedure guardacliente(da : cliente);
begin
assign(archivo,'c:\clientes.dat');
{$I-} reset(archivo); {$I+}
if ioresult <> 0 then
begin
rewrite(archivo);
seek(archivo,0);
write(archivo,da);
close(archivo);
end
else
begin
seek(archivo,filesize(archivo));
write(archivo,da);
close(archivo);
end;
end;

procedure cargacliente(var cuenta : cliente);
var
i : longint;
dato : cliente;
begin
assign(archivo,'c:\clientes.dat');
{$I-} reset(archivo); {$I+}
if ioresult <> 0 then
begin
writeln('Error De Archivo');
end
else
begin
i := 0;
repeat
seek(archivo,i);
read(archivo,dato);
gotoxy(2,2);write(' ');
gotoxy(2,2);write(dato.cedula,' ',dato.nombre);
tec := readkey;
if tec <> #13 then
begin
if tec = #80 then
begin
i := i + 1;
if i > filesize(archivo) - 1 then
i := filesize(archivo) - 1;
end;
if tec = #72 then
begin
i := i - 1;
if i < 0 then
i := 0;
end;
end;
until tec = #13;
cuenta := dato;
end;
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

Necsito meter esto dentro de archivos URGENTE PARA MAÑANA.POR FAVOR AYUDENME!!

Publicado por dani gonzalez (9 intervenciones) el 07/02/2012 16:58:11
Gracias por la idea...!! =D
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