Pascal/Turbo Pascal - programa de votos

 
Vista:
sin imagen de perfil

programa de votos

Publicado por Osmar (1 intervención) el 27/07/2016 07:57:06
Por favor me pofrian ayudar en un programa:
debo hacer u programa donde realice votaciones.........
debo ingresar el numero de votantes, tener 3 partidos postulados y votos nulos, contar cuantos votos tienen cada uno,
dar el porcentaje de cada partido y mostrar:
Quien es el primer lugar
Quien es el segundo lugar
Quien es el tercer lugar
cantidad de votos nulos.
Porfavor necesito que me ayuden.......
En codigo de Dev Pascal o Turbo Pascal
Dios los bendiga
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 de votos

Publicado por ramon (2158 intervenciones) el 28/07/2016 11:59:27
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
{Espero esto te allude }
 
program votaciones;
  uses
     crt;
   const
     lospartidos : array[1..3] of string[40] = (
     'Mirlo','Canario','Ruise¤or');
 
     numvotantes = 1000;
 
   type
     votos = record
             vot : word;
             part : string[40];
           end;
 
     votantes = array[1..4] of votos;
 
 
    var
      lista : votantes;
      m, c, r, n, i : integer;
      partido : char;
      nulos : word;
 
   procedure posicionqueocupan(lo : votantes);
   var
      h, k : integer;
      temp : votos;
   begin
       for h := 1 to 3 do
       begin
         for k := 3 downto h do
         if lo[h].vot < lo[k].vot then
         begin
            temp := lo[h];
            lo[h] := lo[k];
            lo[k] := temp;
         end;
       end;
       writeln('  En Primer Lugar  : ',lo[1].part);
       writeln('  En Segundo Lugar : ',lo[2].part);
       writeln('  En Tercer Lugar  : ',lo[3].part);
   end;
 
   begin
      randomize;
      clrscr;
      nulos := 0;
      fillchar(lista,sizeof(lista),0);
      m := 0;
      c := 0;
      r := 0;
      for i := 1 to numvotantes do
      begin
        n := random(14);
     case n of
 0,13,14 : nulos := nulos + 1;
 1,4,7,10 : begin
           lista[1].vot := lista[1].vot + 1;
           if m < 1 then
           begin
           lista[1].part := lospartidos[1];
           m := m + 1;
           end;
      end;
  2,5,8,11 : begin
           lista[2].vot := lista[2].vot + 1;
           if c < 1 then
           begin
           lista[2].part := lospartidos[2];
           c := c + 1;
           end;
          end;
  3,6,9,12 : begin
           lista[3].vot := lista[3].vot + 1;
           if r < 1 then
           begin
           lista[3].part := lospartidos[3];
           r := r + 1;
           end;
          end;
       end;
    end;
      clrscr;
      writeln('   Resultados Votaciones');
      writeln;
      writeln('  Votantes = ',numvotantes);
      writeln;
      writeln('  Partido : ',lista[1].part,'    = Votos = ',lista[1].vot,
      '  Procentaje = ',lista[1].vot / numvotantes:0:2,'%');
      writeln('  Partido : ',lista[2].part,'  = Votos = ',lista[2].vot,
      '  Procentaje = ',lista[2].vot / numvotantes:0:2,'%');
      writeln('  Partido : ',lista[3].part,' = Votos = ',lista[3].vot,
      '  Procentaje = ',lista[3].vot / numvotantes:0:2,'%');
      writeln('  Votos Nulos                = ',nulos,
      '  Procentaje = ',nulos / numvotantes:0:2,'%');
      writeln;
      writeln('  Lugares Que Ocupan Son');
      writeln;
      posicionqueocupan(lista);
      writeln;
      writeln('  Pulse 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
1
Comentar

programa de votos

Publicado por osmar chacon (1 intervención) el 18/08/2016 05:45:37
Gracias te lo agradezco bastante...............
tenia muchas dudas
bendiciones
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