Pascal/Turbo Pascal - multiplicacion de arrays

 
Vista:

multiplicacion de arrays

Publicado por programita (3 intervenciones) el 07/12/2013 14:39:34
hola tengo un problema tengo que hacer un subprograma que multipliques numeros mas grandes que un entero he pensado unar arrays para hacerlo pero esto no es tan facil ya que si el arrays es de 20 lee los numeros asi ej: 123456 y para multiplicarlo con el otro arrays deberia leerlo asi ej:000000000123456 . necesito ayuda para hacer esto gracias
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

multiplicacion de arrays

Publicado por ramon (2158 intervenciones) el 08/12/2013 17:53:42
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
{Mira multiplicación de asta 20 cifras pero por un dígito para mas tu}
 
 program arrays;
 uses
    crt;
 var
   numero : array[1..20] of integer;
   dato : string[30];
   p, x, y, nu, d, h, cont : integer;
   tec : char;
   oper : string[2];
   resto : boolean;
 
 
 
   begin
      cont := 1;
      x := 3;
      y := 1;
      clrscr;
      gotoxy(x,y);write('Entre Numeros del Multiplicando : ');
      x := 36;
      repeat
         tec := readkey;
         if tec in[#48..#57] then
         begin
            numero[cont] := ord(tec) - 48;
            gotoxy(x + cont,y);write(numero[cont]);
            cont := cont + 1;
            if cont > 20 then
            tec := #13;
         end;
       if tec = #8 then
       begin
          cont := cont - 1;
          if cont < 1 then
          cont := 1;
          numero[cont] := 0;
          gotoxy(x + cont,y);write(' ');
       end;
      until tec = #13;
      clrscr;
      write('   Entre El Multiplicando [1] Digito : ');
      repeat
          tec := readkey;
      until tec in[#49..#57];
      nu := ord(tec) - 48;
      clrscr;
      x := 1;
      y := 1;
      gotoxy(x,y);write('El Multiplicador Es = ');
      for d := cont - 1 downto 1 do
      begin
      gotoxy(22 + d,y);write(numero[d]);
      end;
      y := y + 1;
      gotoxy(x,y);write('El Multiplicando Es = ');
      gotoxy(22 + (cont - 1),y);write(nu);
      y := y + 1;
      gotoxy(x,y);write('El Resultado Es = ');
      p := 30;
      dato[0] := chr(p);
      resto := false;
      for d := cont - 1 downto 1 do
      begin
         h := numero[d] * nu;
         if resto = true then
         begin
         h := h + ord(oper[1]) - 48;
         oper := ' ';
         resto := false;
         end;
         str(h,oper);
         if length(oper) >= 2 then
         begin
         dato[p] := oper[2];
         resto := true;
         end
       else
         dato[p] := oper[1];
         p := p - 1;
      end;
      if oper > ' ' then
      dato[p] := oper[1];
      h := 1;
      for p := 1 to 30 do
      begin
      if dato[p] > ' ' then
      begin
      gotoxy(19 + h,y);write(dato[p]);
      h := h + 1;
      end;
    end;
      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