Pascal/Turbo Pascal - Programa pizzeria

 
Vista:

Programa pizzeria

Publicado por Andrés Lozada (1 intervención) el 08/11/2013 21:26:00
hola!!!! quisiera saber si hay una manera de poder hacer un programa sencillo de una pizzeria en pascal, que genere una factura y me permita seleccionar aparte de los tamanos de pizza al menos unos 3 tipos de pizza mas comunes. queria preguntar tambien si podia hacerse sin necesidad de arrays, osea solo con procedures y lo basico.. si no es mucho trabajo quisiera ver si podian dejarme el algoritmo aqui. gracias de antebrazo.
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

Programa pizzeria

Publicado por ramon (2158 intervenciones) el 09/11/2013 17:13:30
Me puedes dar por lomeemos los tipo de pizza y tamaños que quieres controlar tendré que usar
archivo para guardar los datos espero información.
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

Programa pizzeria

Publicado por ramon (2158 intervenciones) el 09/11/2013 20:23:31
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
{Mira te prepare esto como base}
 
program pizzeria;
 uses
   crt;
  const
   tamapizza1 = 'Grande';
   tamapizza2 = 'Mediana';
   tamapizza3 = 'Peque¤a';
   tipopizza1 = 'Lasa¤a';
   tipopizza2 = 'Jamon';
   tipopizza3 = 'Veicon';
 
  type
    factura = record
         codi : longint;
         tama : integer;
         tipo : integer;
         prec : real;
         unid : integer;
         tota : real;
       end;
 
   var
    f : file of factura;
    dato : factura;
 
   procedure guardar;
   begin
      assign(f,'Pizza.dat');
    {$I-} reset(f); {$I+}
    if ioresult <> 0 then
    begin
       rewrite(f);
       seek(f,0);
       write(f,dato);
       close(f);
    end
  else
     begin
        seek(f,filesize(f));
        write(f,dato);
        close(f);
     end;
   end;
 
   procedure entradadatos;
   begin
      clrscr;
      writeln('   <<< Entrada Factura >>>');
      writeln;
      write('   Entre Codigo cliente : ');
      readln(dato.codi);
      writeln('   Tama¤o : 1=Grande  2=Mediana  3=Peque¤a');
      write('   Entre Tama¤o         : ');
      readln(dato.tama);
      writeln('   Tipo : 1=Lasa¤a  2=Jamon  3=Veicon');
      write('   Entre tipo           : ');
      readln(dato.tipo);
      write('   Entre Precio Unidad  : ');
      readln(dato.prec);
      write('   Entre Num. Unidades  : ');
      readln(dato.unid);
      dato.tota := dato.unid * dato.prec;
      guardar;
   end;
 
   function cargar(n : longint) : boolean;
   var
     tt : longint;
   begin
      cargar := false;
      assign(f,'Pizza.dat');
    {$I-} reset(f); {$I+}
    if ioresult <> 0 then
    begin
       writeln('   Error De Archivo Pulse Una Tecla ');
       readkey;
    end
  else
     begin
        tt := 0;
      repeat
        seek(f,tt);
        read(f,dato);
        tt := tt + 1;
      until (dato.codi = n) or (tt > filesize(f) - 1);
      if dato.codi = n then
      cargar := true;
      close(f);
     end;
   end;
 
   procedure presentafactura;
   var
     bus, codigo : longint;
     encot : boolean;
   begin
      writeln('  ***** Presentacion factura *****');
      writeln;
      write('  Entre Codigo Cliente : ');
      readln(codigo);
      bus := 0;
      encot := false;
      if cargar(codigo) = true then
      begin
         clrscr;
         writeln('  **** Datos Facturacion Cliente ****');
         writeln;
         writeln('    Codigo      = ',dato.codi);
         case dato.tama of
     1 : writeln('    Tama¤o      = ',tamapizza1);
     2 : writeln('    Tama¤o      = ',tamapizza2);
     3 : writeln('    Tama¤o      = ',tamapizza3);
       end;
         case dato.tipo of
     1 : writeln('    Tipo        = ',tipopizza1);
     2 : writeln('    Tipo        = ',tipopizza2);
     3 : writeln('    Tipo        = ',tipopizza3);
        end;
         writeln('    Precio Una  = ',dato.prec:0:2);
         writeln('    Entrgadas   = ',dato.unid);
         writeln('    Importe Tot.= ',dato.tota:0:2);
         writeln;
         writeln('  ***** Pulse Una Tecla *****');
         readkey;
      end
    else
       begin
          writeln('????? Codigo Erroneo Pulse Una Tecla ??????');
          readkey;
       end;
   end;
 
   procedure anulafactura;
   var
      tp, tt, codigo : longint;
      decis : boolean;
      temp : file of factura;
      datp : factura;
      confi : char;
   begin
     assign(f,'Pizza.dat');
    {$I-} reset(f); {$I+}
    if ioresult <> 0 then
    begin
       writeln('   Error De Archivo Pulse Una Tecla ');
       readkey;
    end
  else
     begin
       assign(temp,'temporal.ttt');
       rewrite(temp);
       writeln('  **** Anulacion Factura Cliente ****');
       writeln;
       write('    Entre Codigo Cliente : ');
       readln(codigo);
       writeln;
       writeln(' <<<<<< La Factura Codigo : ',codigo,' Se Anulara >>>>>>');
       writeln;
       writeln(' ???? De Acuerdo [S/N] ????');
       repeat
           confi := upcase(readkey);
       until confi in['S','N'];
       if confi = 'S' then
       begin
       tt := 0;
       tp := 0;
       repeat
          seek(f,tt);
          read(f,dato);
          if dato.codi <> codigo then
          begin
             datp := dato;
             seek(temp,tp);
             write(temp,datp);
             tp := tp + 1;
          end;
          tt := tt + 1;
       until tt > filesize(f) - 1;
       close(f);
       close(temp);
       erase(f);
       rename(temp,'Pizza.dat');
   end
 else
    begin
       close(f);
       close(temp);
       erase(temp);
       writeln('  ///// Anulacion Cancelada Pulse Una Tecla \\\\\');
       readkey;
     end;
    end;
   end;
 
   procedure menu;
   var
      sal : boolean;
      tr : char;
   begin
       sal := false;
     repeat
        clrscr;
        writeln('    ***** Menu Jeneral *****');
        writeln;
        writeln('    1 = Entrada Facturas');
        writeln('    2 = Ver Factura');
        writeln('    3 = Anula Factura');
        writeln('    4 = Salir');
        writeln;
        writeln('    ***** Elija Opcion *****');
        repeat
            tr := readkey;
        until tr in['1','2','3','4'];
        clrscr;
    case tr of
  '1' : entradadatos;
  '2' : presentafactura;
  '3' : anulafactura;
  '4' : sal := true;
    end;
     until sal = true;
   end;
 
   begin
      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