Pascal/Turbo Pascal - necesito ayuda con este programa

 
Vista:
sin imagen de perfil

necesito ayuda con este programa

Publicado por daniel (4 intervenciones) el 26/12/2014 23:07:38
2 Andrés Bello
3 Boconó
4 Bolívar
6 Candelaria
8 Carache
1 Escuque
5 José Felipe Márquez Cañizales
9 Juan Vicente Campo Elías
7 La ceiba
10 Miranda
11 Monte Carmelo
12 Motatán
13 Pampán
14 Pampanito
15 Rafael Rangel
16 San Rafael de Carvajal
17 Sucre
18 Trujillo
19 Urdaneta
20 Valera

a) Tomando en cuenta esta información de la Tabla , realizar un programa en Pascal que ordene los municipios en orden alfabético, aplicando el algoritmo de ordenamiento de la Burbuja.

b) Imprima el vector y nombre de los municipios.

nota: debo trabajar con memoria dinámica, gracias de antemano
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

necesito ayuda con este programa

Publicado por ramon (2158 intervenciones) el 10/01/2015 23:57:55
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
{Mira esto}
 
 program ordenacion;
  uses
     crt;
   const
     ciu = 20;
     ciudades : array[1..ciu] of string[30] = (
     'Bocono','Carache','Andres Bello','Candelaria',
     'Escuque','Juan Vicente Campo Elias','Bolivar',
     'La ceiba','Miranda','Monte Carmelo','Motatan','Pampan',
     'Pampanito','Rafael Rangel','San Rafael de Carvajal','Sucre',
     'Trujillo','Urdaneta','Valera','Jose Felipe Marquez Ca¤izales');
 
   type
      string30 = string[30];
      pdato = ^datos;
      datos = record
            ciudad : string30;
               sig : pdato;
            end;
 
  var
    prin, actu, anter : pdato;
    cont : integer;
 
   procedure insertadatos(d : string30);
   begin
     if prin = nil then
     begin
        new(actu);
        actu^.ciudad := d;
        prin := actu;
        actu^.sig := nil;
     end
   else
      begin
         anter := actu;
         new(actu);
         actu^.ciudad := d;
         anter^.sig := actu;
         actu^.sig := nil;
      end;
   end;
 
   procedure cargadatos;
   begin
      for cont := 1 to ciu do
      begin
         insertadatos(ciudades[cont]);
      end;
   end;
 
   procedure ordenaburbuja;
   var
     auxi : string30;
     tem1, tem2 : pdato;
   begin
      if prin <> nil then
      begin
         tem1 := prin;
       while tem1 <> nil do
       begin
          tem2 := tem1^.sig;
          while tem2 <> nil do
          begin
          if tem1^.ciudad > tem2^.ciudad then
          begin
             auxi := tem1^.ciudad;
             tem1^.ciudad := tem2^.ciudad;
             tem2^.ciudad := auxi;
          end;
            tem2 := tem2^.sig;
       end;
         tem1 := tem1^.sig;
      end;
    end;
  end;
 
   procedure presentadatos(m : string);
   var
     temp : pdato;
     cot : integer;
   begin
       cot := 1;
       writeln(m);
       writeln;
      if prin <> nil then
      begin
         temp := prin;
      while temp <> nil do
      begin
         writeln(cot,' = ',temp^.ciudad);
         temp := temp^.sig;
         cot := cot + 1;
      end;
    end;
   end;
 
 
 
   begin
      clrscr;
      prin := nil;
      cargadatos;
      presentadatos('Desordenados');
      ordenaburbuja;
      writeln;
      presentadatos('Ordenados');
      readkey;
      if prin <> nil then
      dispose(actu);
   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
sin imagen de perfil

necesito ayuda con este programa

Publicado por daniel (4 intervenciones) el 14/01/2015 23:51:19
muchas gracias amigo Ramon por tu ayuda
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar