Pascal/Turbo Pascal - AYUDA ACTIVIIDAD PASCAL

 
Vista:

AYUDA ACTIVIIDAD PASCAL

Publicado por Juan Cruz (1 intervención) el 13/05/2015 02:38:36
Se procesa información estadística de partidos de futbol. Se lee: código de
torneo, código de equipo, código de jugador (1..500), minutos jugados,
cantidad de pases bien dados, cantidad de pases mal dados y cantidad de
goles convertidos. La lectura finaliza con el código de torneo 0, el cual no se
procesa.

Informar:
a) Los dos códigos de torneos con menor promedio de pases bien dados.
b) Por cada torneo, los dos códigos de equipo con mayor cantidad de
goles.
c) El código de jugador del máximo goleador de todos los torneos.
Nota: La información a procesar se lee ordenada por código de torneo y código
de equipo. MODULARIZAR
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 ACTIVIIDAD PASCAL

Publicado por ramon (2158 intervenciones) el 14/05/2015 21:35:51
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
{Espero sea esto lo que quieres sino explica lo mas}
 
program futbol;
 uses
    crt;
 
  const
     max = 6;
 
  type
    registro = record
          c_torneo : longint;
          c_equipo : longint;
         c_jugador : word;
        mint_jugad : real;
        pases_bien : integer;
        pases_mald : integer;
        gales_entr : integer;
             end;
 
   var
     torneo : array[1..max] of registro;
     cont : integer;
 
 
   procedure entrada_datos;
   begin
      cont := 0;
      writeln('   **** Entrada De Datos Finaliza Codigo Torneo = 0 ****');
      writeln;
    repeat
      cont := cont + 1;
      gotoxy(4,4);clreol;
      textcolor(10);
      gotoxy(4,4);write('Codigo Torneo : ');
      gotoxy(20,4);readln(torneo[cont].c_torneo);
      textcolor(7);
      if torneo[cont].c_torneo <> 0 then
      begin
      gotoxy(4,4);clreol;
      gotoxy(4,4);write('Codigo Equipo : ');
      gotoxy(20,4);readln(torneo[cont].c_equipo);
      gotoxy(4,4);clreol;
      gotoxy(4,4);write('Codigo Jugador : ');
      gotoxy(21,4);readln(torneo[cont].c_jugador);
      gotoxy(4,4);clreol;
      gotoxy(4,4);write('Minutos Jugados : ');
      gotoxy(22,4);readln(torneo[cont].mint_jugad);
      gotoxy(4,4);clreol;
      gotoxy(4,4);write('Pases Bien Dados : ');
      gotoxy(23,4);readln(torneo[cont].pases_bien);
      gotoxy(4,4);clreol;
      gotoxy(4,4);write('Pases Mal Dados : ');
      gotoxy(22,4);readln(torneo[cont].pases_mald);
      gotoxy(4,4);clreol;
      gotoxy(4,4);write('Goles Metidos : ');
      gotoxy(20,4);readln(torneo[cont].gales_entr);
      end;
    until (torneo[cont].c_torneo = 0) or (cont > max);
    clrscr;
   end;
 
   procedure menor_promedio_de_pases_bien_dados;
   var
     m, h, r : integer;
     code : longint;
     combi : registro;
   begin
      if cont > 1 then
      begin
       for m := 1 to cont - 1 do
         for h := m + 1 to cont - 1 do
         if torneo[m].pases_bien > torneo[h].pases_bien then
         begin
            combi := torneo[m];
            torneo[m] := torneo[h];
            torneo[h] := combi;
         end;
          writeln('  Los Equipos Con Menor Promedio De Pases Bien Dados Son');
          writeln;
          writeln('  Equipos = ',torneo[1].c_torneo);
          writeln('  Equipos = ',torneo[2].c_torneo);
         end
      else
          begin
             writeln('   Dadot Sin Cargar Pulse Una Tecla');
             readkey;
          end;
       end;
 
  procedure equipo_con_mayor_cantidad_de_goles;
   var
     m, h, r : integer;
     code : longint;
     combi : registro;
   begin
      if cont > 1 then
      begin
       for m := 1 to cont - 1 do
         for h := m + 1 to cont - 1 do
         if torneo[m].gales_entr > torneo[h].gales_entr then
         begin
            combi := torneo[m];
            torneo[m] := torneo[h];
            torneo[h] := combi;
         end;
          writeln('  Equipo Con Mayor Cantidad De Goles');
          writeln;
          writeln('  Equipos = ',torneo[cont - 1].c_torneo);
          writeln('  Equipos = ',torneo[cont - 2].c_torneo);
         end
      else
          begin
             writeln('   Dadot Sin Cargar Pulse Una Tecla');
             readkey;
          end;
       end;
   procedure maximo_goleador_de_todos_los_torneos;
   var
     m, h, r : integer;
     code : longint;
     combi : registro;
   begin
      if cont > 1 then
      begin
       for m := 1 to cont - 1 do
         for h := m + 1 to cont - 1 do
         if torneo[m].gales_entr > torneo[h].gales_entr then
         begin
            combi := torneo[m];
            torneo[m] := torneo[h];
            torneo[h] := combi;
         end;
          writeln(' Maximo Goleador De Todos Los Torneos ');
          writeln;
          writeln('  Goleador = ',torneo[cont - 1].c_jugador);
          writeln('  Goleador = ',torneo[cont - 2].c_jugador);
         end
      else
          begin
             writeln('   Dadot Sin Cargar Pulse Una Tecla');
             readkey;
          end;
       end;
 
 
  begin
      clrscr;
      entrada_datos;
      menor_promedio_de_pases_bien_dados;
      writeln;
      equipo_con_mayor_cantidad_de_goles;
      writeln;
      maximo_goleador_de_todos_los_torneos;
      writeln;
      writeln('   Pulde Una Tecla');
      readkey;
  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