Pascal/Turbo Pascal - Ayuda para resolver estos 2 ejercicios en pascal

 
Vista:
Imágen de perfil de Alejandra
Val: 1
Ha disminuido su posición en 75 puestos en Pascal/Turbo Pascal (en relación al último mes)
Gráfica de Pascal/Turbo Pascal

Ayuda para resolver estos 2 ejercicios en pascal

Publicado por Alejandra (18 intervenciones) el 20/08/2015 02:14:11
PROGRAMACION-PASCAL-5-6

BUENAS NOCHES!

necesito ayuda para resolver estos 2 ejercicios en pascal.-

desde ya gracias por la ayuda.-
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

Ayuda para resolver estos 2 ejercicios en pascal

Publicado por ramon (2158 intervenciones) el 30/08/2015 17:59:25
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
¨{Mira esto te encaminara para el otro}
 
program ventas10;
 uses
    crt;
 
   type
      string50 = string[50];
      datosventas = record
             codigovend : string50;
             zonas : array['A'..'j'] of real;
             poszona : char;
           end;
 
   var
     f : file of datosventas;
     dat : datosventas;
     i, t : integer;
     letra : char;
     activa : string50;
 
   procedure entradaventas(codi : string50);
   var
      salir : boolean;
      ttr : char;
      pp : longint;
   begin
      for pp := 1 to length(codi) do
      codi[pp] := upcase(codi[pp]);
      pp := 0;
      assign(f,'altas.dat');
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
       dat.codigovend := codi;
       letra := 'A';
       salir := false;
       repeat
          write('   Entre Importe Venta En Zana ',letra,' : ');
          readln(dat.zonas[letra]);
          dat.poszona := letra;
          writeln;
          writeln('   Desea Entrar Mas Datos A Este Vendedor [S/N]');
          repeat
              ttr := upcase(readkey);
          until ttr in['S','N'];
          if ttr = 'N' then
          begin
            rewrite(f);
            seek(f,pp);
            write(f,dat);
            close(f);
            salir := true;
          end
       else
          begin
             rewrite(f);
             seek(f,pp);
             write(f,dat);
             pp := pp + 1;
             letra := upcase(chr(ord(letra) + 1));
             if letra > 'J' then
             salir := true;
          end;
       until salir = true;
     end
   else
      begin
         salir := false;
         for pp := 0 to filesize(f) - 1 do
         begin
            seek(f,pp);
            read(f,dat);
            if dat.codigovend = codi then
            begin
            salir := true;
            break;
            end;
         end;
           if salir = true then
           begin
              letra := upcase(chr(ord(dat.poszona) + 1));
             repeat
              write('   Entre Importe Venta En Zana ',letra,' : ');
              readln(dat.zonas[letra]);
              dat.poszona := letra;
              writeln;
              writeln('   Desea Entrar Mas Datos A Este Vendedor [S/N]');
          repeat
              ttr := upcase(readkey);
          until ttr in['S','N'];
          if ttr = 'N' then
          begin
            seek(f,pp);
            write(f,dat);
            close(f);
            salir := true;
          end
       else
          begin
             seek(f,pp);
             write(f,dat);
             pp := pp + 1;
             letra := upcase(chr(ord(letra) + 1));
             if letra > 'J' then
             salir := true;
          end;
       until salir = true;
           end;
      end;
    end;
 
   procedure presentadatos(gg : char);
   var
      h : longint;
      co : string50;
      i : integer;
      td : char;
   begin
      gg := upcase(gg);
      if gg in['T','U'] then
      begin
         assign(f,'altas.dat');
      {$I-} reset(f); {$I+}
      if ioresult <> 0 then
      begin
        writeln;
        writeln('    Error De Archivo  Pulse Una Tecla');
        readkey;
      end
   else
      begin
         if gg = 'T' then
         begin
            clrscr;
            for h := 0 to filesize(f) - 1 do
            begin
               seek(f,h);
               read(f,dat);
               if dat.codigovend <> '' then
               writeln('   Codigo = ',dat.codigovend);
               for td := 'A' to dat.poszona do
               write('   ',td,' = ',dat.zonas[td]:0:2);
            end;
            close(f);
            readkey;
         end;
         if gg = 'U' then
         begin
             clrscr;
             write('   Entre Codigo Comprador : ');
             readln(co);
             clrscr;
             for i := 1 to length(co) do
             co[i] := upcase(co[i]);
             for h := 0 to filesize(f) - 1 do
             begin
                seek(f,h);
                read(f,dat);
                for i := 1 to length(dat.codigovend) do
                dat.codigovend[i] := upcase(dat.codigovend[i]);
                if dat.codigovend = co then
                begin
                   close(f);
                   clrscr;
                   writeln('   Datos Del Vendedor  ',co);
                   writeln;
                   writeln('  Codigo = ',dat.codigovend);
                   for td := 'A' to dat.poszona do
                   writeln('  Ventas  = ',td,' = ',dat.zonas[td]:0:2);
                   readkey;
                end;
             end;
          end;
       end;
     end;
   end;
 
   procedure informemaxventa;
   var
     co : string50;
     k : longint;
     s, a : char;
     total : real;
     sal : boolean;
     i : integer;
     va : real;
   begin
       clrscr;
       sal := false;
       write('   Entre Codigo Comprador : ');
       readln(co);
       clrscr;
       for i := 1 to length(co) do
       co[i] := upcase(co[i]);
       assign(f,'altas.dat');
      {$I-} reset(f); {$I+}
      if ioresult <> 0 then
      begin
        writeln;
        writeln('    Error De Archivo  Pulse Una Tecla');
        readkey;
      end
   else
      begin
       for k := 0 to filesize(f) - 1 do
       begin
           seek(f,k);
           read(f,dat);
           for i := 1 to length(dat.codigovend) do
           dat.codigovend[i] := upcase(dat.codigovend[i]);
           if dat.codigovend = co then
           begin
              sal := true;
              break;
           end;
        end;
       close(f);
       if sal = true then
       begin
          total := 0.0;
          for a := 'A' to dat.poszona do
          total := total + dat.zonas[a];
          va := 0;
          for a := 'A' to dat.poszona do
          if dat.zonas[a] > va then
          begin
             va := dat.zonas[a];
             s := a;
          end;
          clrscr;
          writeln('   El Maximo Valor Es = ',va:0:2,' De ',s);
          writeln('   El Total Es        = ',total:0:2);
          readkey;
       end;
     end;
   end;
 
   procedure menu;
   var
     rr, tecla : char;
     salimo : boolean;
   begin
      salimo := false;
    repeat
        clrscr;
        writeln;
        writeln('    **** Menu Jeneral ****');
        writeln;
        writeln('   1 = Entradas Vendedor');
        writeln('   2 = Mostrar Ventas');
        writeln('   3 = Resumenes');
        writeln('   4 = Salir');
        writeln;
        writeln('    Elije Opcion ');
        repeat
            tecla := readkey;
        until tecla in['1','2','3','4'];
        clrscr;
       case tecla of
  '1' : begin
         write('   Entre El Codigo Vendedor : ');
         readln(activa);
         entradaventas(activa);
        end;
  '2' : begin
           write('   Presentar Datos De Un Vendedor O Todos [T/U]');
           repeat
              rr := upcase(readkey);
           until rr in['T','U'];
           presentadatos(rr);
        end;
  '3' : informemaxventa;
  '4' : salimo := true;
    end;
    until salimo = true;
   end;
 
 
   begin
       clrscr;
       fillchar(dat,sizeof(datosventas),0);
       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
2
Comentar
Imágen de perfil de Alejandra
Val: 1
Ha disminuido su posición en 75 puestos en Pascal/Turbo Pascal (en relación al último mes)
Gráfica de Pascal/Turbo Pascal

Ayuda para resolver estos 2 ejercicios en pascal

Publicado por Alejandra (18 intervenciones) el 30/08/2015 18:19:49
Gracias ramon por contestar!!!!
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