Pascal/Turbo Pascal - corregir codigo gracias

 
Vista:
sin imagen de perfil

corregir codigo gracias

Publicado por Maria (7 intervenciones) el 26/08/2017 17:40:37
mi problemas es el siguiente estoy tratanto de haver este programa para un trabajo de estudio pero tengo poco de estar practicando con pascal loque basicamente quiero hacer es lo siguiente
1.un menu en el cual tire una opcion de hacer registro
2.hacer el registro
3.hacer una compra de un producto ejemplo un carro
4. que me imprima la direcion en estevcaso pais y ciudad de la persona que lo compra

si alguien me pudiera ayudar con el codigo


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
program menu_general;
uses crt;
 
Var opcion : char;
 
  procedure menu;
 
  begin
 
    repeat
 
    clrscr;
 
      writeln ('------ Menu Ebay------');
 
      writeln ('1.REGISTRARSE.');
 
      writeln;
 
      Writeln('Introduzca una opcion del menu');
 
      repeat
 
         opcion := readkey;
 
      until opcion in['1','3'];
 
      clrscr;
 
   case opcion of
 
 '1' : writeln('1.Registarse');
 
 '3' : writeln('3.continuar compra.');
 
 end;
 
   if opcion in['1','3'] then
 
   begin
 
   writeln;
 
   writeln('Pulsa [Enter]');
 
   readln;
 
   end;
 
 until opcion = '3';
 
end;
BEGIN
readkey;
BEGIN
 
type
usuario = RECORD
nombre:string[30];
edad:interger;
pais:string[30];
ciudad:string[30];
telefono:string[15];
end;
var
alumno:alumnos;
BEGIN
clrscr;
 
write('dame nombre: ');readln(usuario.nombre);
write('dame edad : ');readln(usuario.edad);
write('dame pais : ');readln(usuario.pais);
write('dame ciudad : ');readln(usuario.ciudad);
write('dame telefono : ');readln(usuario.telefono);
 
writeln;writeln;
writeln('nombre : ',usuario.nombre);
writeln('edad : ',usuario.edad);
writeln('pais : ',usuario.pais);
writeln('ciudad : ',usuario.ciudad);
writeln('telefono : ',usuario.telefono);
readln;
writeln;
write('GRACIAS POR SU REGISTRO');
readkey;
END,
begin
 
     crt;
 
  const
 
        max = 5; {// cantidad maxima de productos}
 
   type
 
        {// tipo de registro para cada producto}
 
      Rproducto = record
 
        cod : integer; {// codigo del producto}
 
        nom : string[20]; {// nombre}
 
       prov : string[30]; {// proveedor}
 
       prec : real; {// precio}
 
   end;
 
   {// tipo de  array de registro}
 
   Tarray = array[1..max] of Rproducto;
 
   var
 
   reg, productos : Tarray;
 
   len : integer;
 
 
 
   procedure listado(len : integer; pos : integer);
 
   var
 
     i : integer;
 
   begin
 
      i := pos;
 
      clrscr;
 
    while (i <= len) do
 
    begin
 
         writeln('Codigo de producto : ',reg[i].cod);
 
         writeln('Nombre :  ',reg[i].nom);
 
         writeln('Proveedor :  ',reg[i].prov);
 
         write('Precio :  $',reg[i].prec:4:2);
 
         writeln;
 
         i := i + 1;
 
    end;
 
  end;
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

corregir codigo gracias

Publicado por ramon (2158 intervenciones) el 26/08/2017 22:25:24
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
{A ver si esto ayuda}
 
program ventaint;
 uses
    crt;
  const
     max = 5;
 
  type
      Rproducto = record
        cod : integer; {// codigo del producto}
        nom : string[20]; {// nombre}
       prov : string[30]; {// proveedor}
       prec : real; {// precio}
     end;
 
      usuario = RECORD
           nombre : string[30];
             edad : integer;
             pais : string[30];
           ciudad : string[30];
         telefono : string[15];
         Tarray : array[1..max] of Rproducto;
         nentradas : integer;
      end;
 
    var
      cont : integer;
      pedido : usuario;
 
 
    procedure entrada_pedidos(var p : usuario);
    var
      tec : char;
      sal : boolean;
    begin
       clrscr;
       sal := false;
       writeln('   Datos cliente');
       writeln;
       write('   Entre Nombre   : ');
       readln(p.nombre);
       write('   Entre Edad     : ');
       readln(p.edad);
       write('   Entre Pais     : ');
       readln(p.pais);
       write('   Entre Ciudad   : ');
       readln(p.ciudad);
       write('   Entre Telefono : ');
       readln(p.telefono);
       writeln;
       cont := 1;
       repeat
       writeln('   Entradas Compras');
       writeln;
       write('   Entre Codigo       : ');
       readln(p.tarray[cont].cod);
       write('   Entre Nombre Prod. : ');
       readln(p.tarray[cont].nom);
       write('   Entre Proveedor    : ');
       readln(p.tarray[cont].prov);
       write('   Entre Precio       : ');
       readln(p.tarray[cont].prec);
       writeln;
       writeln('   Desea Entrar Mas Productos [S/N]');
       repeat
          tec := upcase(readkey);
       until tec in['S','N'];
       if tec = 'N' then
       sal := true;
       if tec = 'S' then
       cont := cont + 1;
       if cont > max then
       sal := true;
     until sal = true;
     p.nentradas := cont - 1;
    end;
 
   procedure mostrardatos(d : usuario);
   begin
      clrscr;
      writeln('    Datos Cliente  ');
      writeln;
      writeln('   Nombre   : ',d.nombre);
      writeln('   Edad     : ',d.edad);
      writeln('   Pais     : ',d.pais);
      writeln('   Ciudad   : ',d.ciudad);
      writeln('   Telefono : ',d.telefono);
      writeln;
      writeln('   Pulse Una Tecla  ');
      readkey;
   end;
 
  procedure mostrarpedidos(p : usuario);
  var
    t : integer;
  begin
      clrscr;
      writeln('    Datos Pedido Cliente ');
      writeln;
      for t := 1 to p.nentradas do
      begin
        writeln(p.tarray[t].cod,'   ',p.tarray[t].nom,'   ',p.tarray[t].prov,
        '   ',p.tarray[t].prec);
     end;
     writeln;
     writeln('   Pedidos Realizados : ',p.nentradas);
     writeln;
     writeln('   Pulse Una Tecla ');
     readkey;
  end;
 
    procedure menu;
    var
      tecla : char;
      fin : boolean;
    begin
       fin := false;
     repeat
        clrscr;
        writeln('  *****  Menun Jeneral  *****');
        writeln('         /////////////       ');
        writeln;
        writeln('   1 = Entrada Datos Cliente ');
        writeln('   2 = Mostrar Datos Cliente ');
        writeln('   3 = Mostrar Datos Cliente y Ventas ');
        writeln('   4 = Salir');
        writeln;
        writeln('   <<<< Elija Opcion >>>>');
        repeat
            tecla := readkey;
        until tecla in['1','2','3','4'];
        clrscr;
    case tecla of
 '1' : entrada_pedidos(pedido);
 '2' : mostrardatos(pedido);
 '3' : mostrarpedidos(pedido);
 '4' : fin := true;
   end;
     until fin = true;
  end;
 
  begin
     menu;
  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