Pascal/Turbo Pascal - PROGRAMAS FACILES ARRAY AYUDA

 
Vista:
sin imagen de perfil

PROGRAMAS FACILES ARRAY AYUDA

Publicado por Malic (7 intervenciones) el 18/04/2016 18:18:02
Porfavor si alguien puede implementar algun programa que lo escriba,muchisimas gracias por vuestro tiempo de verdad...

1)TENEMOS UN ARRAY UNIDIMENSIONAL CON N COMPONENTES QUE SON NUMEROS ENTEROS(INTEGER)DETERMINE EL COMPONENTE POSITIVO MAS GRANDE Y HALLE SU INDICE

2)TENEMOS UN ARRAY UNIDIMENSIONAL CON N COMPONENTES INTEGER.DETERMINE EL NUMERO DE COMPONENTES QUE TIENEN UN VALOR MENOR A LA MEDIA ARITMETICA DE LOS COMPONENTES DEL ARRAY Y HALLE SU INDICE

3)UN ARRAY UNIDIMENSIONAL CON N COMPONENTES INTEGER.DETERMINE EL COMPONENTE CON VALOR NEGATIVO MAYOR Y HALLE SU INDICE

4)UN ARRAY UNIDIMENSIONAL CON N COMPONENTES INTEGER.DETERMINE SI LOS VALORES DE LOS COMPONENTES REPRESENTAN UNA SECUENCIA ASCENTENTE
***Y OTRO PROGRAMA PARA VER SI ES DESCENDENTE***
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
sin imagen de perfil

PROGRAMAS FACILES ARRAY AYUDA

Publicado por crack81 (58 intervenciones) el 18/04/2016 23:42:46
Hola he realizado tus dos primeros problemas, con ellos te puedes basar para terminar los siguientes, si tienes dudas no avises en avisar saludos...


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
procedure llenadoAleatorioPositivo_Negativo(var arreglo:array of integer; positivo:Boolean=True);
var
  i:Integer;
  nPositivo:Byte;
begin
  if positivo then nPositivo:=1
  else nPositivo:=-1;
 
  Randomize;
  for i:=Low(arreglo) to High(arreglo) do
  begin
    arreglo[i]:=Random(100)*nPositivo;
  end;
end;
 
 
procedure imprimirComponenete_Mayor_Y_Indice(arreglo:array of integer);
var
  i:Integer;
  maximo,indice:integer;
begin
    maximo:=0;
    for i:=Low(arreglo) to High(arreglo) do
    begin
       if arreglo[i]>maximo then
       begin
          maximo:=arreglo[i];
          indice:=i;
       end;
    end;
 
    WriteLn('Componente mas grande del arreglo: ',maximo,' y su indice es: ',indice);
end;
 
procedure imprimirMediaAritmetica_Y_Indice(arreglo:array of integer);
var
  i:Integer;
  media:Integer;
begin
  media:=0;
  for i:=Low(arreglo) to High(arreglo) do
  begin
    media:=media+arreglo[i];
  end;
  media:=media div Length(arreglo);
 
 
  WriteLn('La media arimetica es ',media);
  for i:=Low(arreglo) to High(arreglo) do
  begin
    if  arreglo[i]<media then
    begin
       WriteLn('Componente menor a la media aritmetica: ',arreglo[i],' y su indices es: ',i);
    end;
  end;
end;
 
 
const
  TAMANO=10;
var
  arreglo:array of integer;
begin
   //Asignamos el tamano al arreglo
   SetLength(arreglo,TAMANO);
 
   //llenamos el arreglo con numeros aleatorios postivios
   llenadoAleatorioPositivo_Negativo(arreglo);
 
 
   //Problema 1
   imprimirComponenete_Mayor_Y_Indice(arreglo);
 
   Writeln;//Saltamos linea
 
   //Problema 2
   imprimirMediaAritmetica_Y_Indice(arreglo);
 
   ReadLn;
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

PROGRAMAS FACILES ARRAY AYUDA

Publicado por ramon (2158 intervenciones) el 20/04/2016 11:45:23
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
{Mira si esto ayuda }
 
program numeros;
  uses
     crt;
   const
      compo = 15;
   var
     numero : array[0..compo - 1] of integer;
     cont, num, may : integer;
 
 
  procedure rellenaarray(var ar : array of integer);
  begin
     for may := 0 to compo - 1 do
     begin
        num := random(100) + 1;
    if num > 30 then
    ar[may] := -num
  else
    ar[may] := num;
    end;
  end;
 
  procedure mayorpositivo;
  var
    toma, indi : integer;
  begin
     toma := numero[0];
     indi := 0;
     for cont := 1 to compo - 1 do
     begin
        if toma < numero[cont] then
        begin
           toma := numero[cont];
           indi := cont;
        end;
     end;
      write('   El Mayor Positivo Es : ',toma,'   Indice : ',indi);
  end;
 
  procedure mediaaricmetica;
  var
    sum, mea : array[1..compo] of integer;
    t, media, suma, nm, c : integer;
  begin
      nm := 0;
      suma := 0;
      for c := 0 to compo - 1 do
      begin
         suma := suma + numero[c];
      end;
        media := suma div c;
        t := 1;
        write('   La Media Es : ',media);
        writeln;
        for c := 0 to compo - 1 do
        begin
          if numero[c] < media then
          begin
            mea[t] := numero[c];
            sum[t] := c;
            t := t + 1;
          end;
        end;
        for c := 1 to t - 1 do
        writeln('   Los Mas Bajo De La Media Es : ',mea[c],'   El Indice : ',sum[c]);
  end;
 
  procedure negativomayor;
  var
    num, c, ind : integer;
  begin
     num := numero[0];
     ind := 0;
     for c := 1 to compo - 1 do
     begin
        if (numero[c] < 0) and (num > numero[c]) then
        begin
           num := numero[c];
           ind := c;
        end;
     end;
       write('  El Negativo Mayor Es : ',num,'   El Indice : ',ind);
  end;
 
  function descendente : boolean;
  var
    nn, d : integer;
    si : boolean;
    begin
       si := false;
       nn := numero[0];
       for d := 1 to compo - 1 do
       if numero[d] > nn then
       begin
         si := true;
       end
     else
        begin
          si := false;
          break;
        end;
       descendente := si;
    end;
 
  function ascendente : boolean;
  var
    nn, d : integer;
    si : boolean;
    begin
       si := false;
       nn := numero[0];
       for d := 1 to compo - 1 do
       if numero[d] < nn then
       begin
         si := true;
       end
     else
        begin
          si := false;
          break;
        end;
       ascendente := si;
    end;
 
  begin
     rellenaarray(numero);
     clrscr;
     for cont := 0 to compo - 1 do
     write(' ',numero[cont]);
     writeln;
     mayorpositivo;
     writeln;
     mediaaricmetica;
     writeln;
     negativomayor;
     writeln;
     write('   Es Descendente : ',descendente);
     writeln;
     write('   Es Ascendente  : ',ascendente);
     writeln;
     write('   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
0
Comentar