Pascal/Turbo Pascal - cajero automatico urgente

 
Vista:

cajero automatico urgente

Publicado por eduardo (1 intervención) el 07/05/2014 06:38:56
oigan necesito un cajero automatico en pascal para ahorita resolverlo su funcionamiento y resultado clave de acceso deposito, saldo, retiro y salida
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

cajero automatico urgente

Publicado por ramon (2158 intervenciones) el 09/05/2014 01:13:39
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
{A ver si esto es lo que quieres}
 
program cajero;
 uses
   crt, dos;
 type
    cliente = record
            codigocli : longint;
            numcuenta : longint;
            deposito  : real;
            saldo     : real;
            retiro    : real;
            salida    : real;
          end;
 
   var
     cuenta : cliente;
     f : file of cliente;
 
 
 
    procedure guardacliente(c : cliente);
    begin
       assign(f,'Cajero.dat');
    {$I-} reset(f); {$I+}
    if ioresult <> 0 then
    begin
       rewrite(f);
       seek(f,0);
       write(f,c);
       close(f);
    end
  else
      begin
         seek(f,filesize(f));
         write(f,c);
         close(f);
      end;
    end;
 
    procedure entradacuenta;
    begin
       clrscr;
       writeln('   **** Entrada Cuenta Nuevo Cliente ****');
       writeln;
       write('  Codigo Cliente = ');
       readln(cuenta.codigocli);
       write('  Numero Cuenta  = ');
       readln(cuenta.numcuenta);
       write('  Deposito       = ');
       readln(cuenta.deposito);
       cuenta.saldo := cuenta.deposito;
       cuenta.retiro := 0;
       cuenta.salida := 0;
       writeln;
       writeln('   Pulse Una Tecla');
       readkey;
    end;
 
  procedure sacadelcajero;
  var
    ncuent, nclave : longint;
    vu : longint;
    imp : real;
    encont : boolean;
  begin
     clrscr;
     write('   Entre Num. Cuenta : ');
     readln(ncuent);
     write('   Entre Clave       : ');
     readln(nclave);
     assign(f,'Cajero.dat');
    {$I-} reset(f); {$I+}
    if ioresult <> 0 then
    begin
        writeln('  Error De Archivo Pulse Una Tecla');
        readkey;
    end
  else
      begin
        encont := false;
        vu := 0;
     repeat
        seek(f,vu);
        read(f,cuenta);
        if (cuenta.codigocli = nclave) and (cuenta.numcuenta = ncuent) then
        begin
           encont := true;
        end
      else
        vu := vu + 1;
     until (encont = true) or (vu > filesize(f) - 1);
     if encont = true then
     begin
        clrscr;
        writeln('  Datos Correctos ');
        writeln;
        write('  Entre Inporte : ');
        readln(imp);
        if imp <= cuenta.saldo then
        begin
           writeln('  Serbicio Correcto ');
           cuenta.retiro := imp;
           cuenta.salida := imp;
           cuenta.saldo := cuenta.saldo - imp;
           seek(f,vu);
           write(f,cuenta);
           close(f);
           writeln;
           writeln(' Pulse Una Tecla');
           readkey;
        end
     else
        begin
           writeln('  Su Saldo Actual No Cubre Lo Pedido');
           writeln(' Pulse Una Tecla');
           close(f);
           readkey;
        end;
     end
   else
      begin
      writeln('  Lo Siento Sus Datos Son Erroneos Intentelo De Nuevo ');
      writeln('  Pulse Una Tecla');
      close(f);
      readkey;
      end;
    end;
  end;
 
 
  begin
      clrscr;
      entradacuenta;
      guardacliente(cuenta);
      sacadelcajero;
  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