Pascal/Turbo Pascal - CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

 
Vista:

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 28/01/2013 18:09:16
BUENAS NESECITO QUE ME AYUDEN ES UN PROGRAMA EN TURBO PASCAL 7.0 NESECITO QUE SEA LO MAS EXPLICADO POSIBLE, POR EJEMPLO: QUE ESTRUCTURAS REPETITIVAS USARON Y CUANTAS, LOS NOMBRES DE LOS PROCEDIMIENTOS Y FUNCIONES .
PORFAVOR SI PUEDEN REALIZARME UN DIAGRAMA DE FLUJO
LO MINIMO QUE LLEVE EL PROGRAMA LO MAS EXPLICADO POSIBLE
Y TAMBIEN EXPLICARME COMO PUEDO GRABAR ESE PROGRAMA EN UN CD
MUCHAS GRACIAS EL PROGRAMA ES :

Programa Hotel
El hotel EL DESCANSO necesita un sistema automatizado para sustituirlo por el sistema manual que han utilizado hasta ahora. El sistema debe permitirles imprimir la factura legal para sus clientes.
El Hotel consta de lo siguiente:




Tipo Habitación Cantidad Precio (Bs)
VIP 5 500
Triples 15 350
Matrimoniales 15 250
Adicionalmente vende los siguientes artículos
Producto Precio (Bs)
Agua Mineral 5
Helado 45
Chocolate 20
Dentífrico 25
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por ramon (2158 intervenciones) el 30/01/2013 16:57:10
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
{Algo como estro te ayudara}
 
 program hotel;
   uses
      crt;
   type
      habitacion = (Vip,Triple,Matrimonio,todo1);
      productos = (Agua_Mineral,Helado,Chocolate,Dentrifico,todo2);
      reghotel = record
            habit : array[habitacion] of record
                                    preci : array[1..35] of word;
                                    nut : integer;
                                    end;
            Artic : array[productos] of record
                                   preci : array[1..95] of word;
                                   nud : integer;
                                  end;
                                end;
    var
       dahotel : array[1..12] of reghotel;
       cli : integer;
 
    procedure entrada_datos(cl : integer);
    var
      tt, tec : char;
      n : integer;
    begin
        writeln('**** Datos Cliente ****');
        n := 1;
      repeat
        writeln('  Tipo De Habitacion : ');
        write('  1 = Vip   2 = Triple   3 = Matrimonio');
        repeat
            tec := readkey;
        until tec in[#49..#51];
        case tec of
     #49 : dahotel[cl].habit[vip].preci[n] := 500;
     #50 : dahotel[cl].habit[triple].preci[n] := 350;
     #51 : dahotel[cl].habit[matrimonio].preci[n] := 250;
       end;
    writeln;
    writeln(' Desea Entrar Mas Datos Para Este Cliente [S/N]');
    repeat
    tt := upcase(readkey);
    until tt in['S','N'];
    if tt = 'S' then
    begin
    n := n + 1;
    if n > 35 then
    n := 35;
    end;
    until tt = 'N';
    dahotel[cl].habit[todo1].nut := n;
   clrscr;
   n := 1;
   repeat
       writeln;
       writeln('  Productos ');
 writeln(' 1 = Agua Mineral   2 = Helado   3 = Chocolate   4 = Dentifrico');
 repeat
    tec := readkey;
 until tec in[#49..#52];
   case tec of
 #49 : dahotel[cl].Artic[Agua_Mineral].preci[n] := 5;
 #50 : dahotel[cl].Artic[Helado].preci[n] := 45;
 #51 : dahotel[cl].Artic[Chocolate].preci[n] := 20;
 #52 : dahotel[cl].Artic[Dentrifico].preci[n] := 25;
   end;
    writeln;
    writeln(' Desea Entrar Mas Datos Para Este Cliente [S/N]');
    repeat
    tt := upcase(readkey);
    until tt in['S','N'];
    if tt = 'S' then
    begin
    n := n + 1;
    if n > 95 then
    n := 95;
    end;
  until tt = 'N';
  dahotel[cl].Artic[todo2].nud := n;
 end;
 
   procedure presentafactura(nn : integer);
   var
      i, t : integer;
   begin
       for i := 1 to  nn do
       begin
          for t := 1 to dahotel[i].habit[todo1].nut do
          if dahotel[i].habit[vip].preci[t] > 0 then
          writeln(' Habitacion Vip = ',dahotel[i].habit[vip].preci[t]);
          if dahotel[i].habit[triple].preci[t] > 0 then
          writeln(' Habitacion Triple = ',dahotel[i].habit[triple].preci[t]);
  if dahotel[i].habit[matrimonio].preci[t] > 0 then
  writeln(' Habitacion matrimonio = ',dahotel[i].habit[matrimonio].preci[t]);
       end;
       for t := 1 to dahotel[i].Artic[todo2].nud do
       begin
  if dahotel[i].Artic[Agua_Mineral].preci[t] > 0 then
 writeln(' Producto Agua_Mineral = ',dahotel[i].Artic[Agua_Mineral].preci[t]);
 if dahotel[i].Artic[Helado].preci[t] > 0 then
 writeln(' Producto Helado = ',dahotel[i].Artic[Helado].preci[t]);
 if dahotel[i].Artic[Chocolate].preci[t] > 0 then
 writeln(' Producto Chocolate = ',dahotel[i].Artic[Chocolate].preci[t]);
 if dahotel[i].Artic[Dentrifico].preci[t] > 0 then
 writeln(' Producto Dentrifico = ',dahotel[i].Artic[Dentrifico].preci[t]);
       end;
    writeln;
    writeln('  Pulse [Enter]');
    readln;
   end;
 
 
   begin
       clrscr;
       cli := 1;
       entrada_datos(cli);
       clrscr;
       presentafactura(cli);
   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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 30/01/2013 18:41:55
oye muy bien pero no me explicastes que metodos utilizastes estructuras todo eso yo al ver la gran lista quede veo muchas estructuras conocidas pero tambien veo muchas desconocidas la verdad seria muy bueno que me eches una explicadita breve jeje por ejemplo porque tantos arreglos y que estructura es "reghotell" ? gracias
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por ramon (2158 intervenciones) el 30/01/2013 18:57:39
Es pero te sirva en breves te pasare una es explicación de el esto es para ver si te vale
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 30/01/2013 19:46:03
mira el programa corre pero al salirme los tipos de habitaciones no hace mas nada de hay y si presiono cualkier tecla me sale desea continuar? y le soy "s" y no hace nada o le doy "n" y tampoco hace nada =s
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 30/01/2013 20:34:37
me ah pasado eso en clases que no hace nada y era falta de un readkey pero en este liston no se donde la falta jeje yo kiero que la factura me la muestre por pantalla y en pantalla solo me muestra los tipos de habitaciones nada mas y el bucle de que si kiere continuar al parecer no anda jeje ayudame un poco ese proyecto me toca entregarlo dentro de dos dias nesecito que me ande el programa jeje porfas mucha ayuda de antemano gracias
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por ramon (2158 intervenciones) el 30/01/2013 21:21:04
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
program hotel;
   uses
      crt;
   type
      habitacion = (Vip,Triple,Matrimonio,todo1); {Tipo de Conjunto}
      productos = (Agua_Mineral,Helado,Chocolate,Dentrifico,todo2);
      reghotel = record  {Registro de los datos a manejar}
            habit : array[habitacion] of record {Registro de habitacionas}
                                    preci : array[1..35] of word;
                                    nut : integer;
                                    end;
            Artic : array[productos] of record  {Registro de productos}
                                   preci : array[1..95] of word;
                                   nud : integer;
                                  end;
                                end;
    {Estos son registros dentro del registro general}
    var
       dahotel : array[1..12] of reghotel; {Un variable array de 12 registros}
       cli : integer;  {variable apuntadora para el array}
 
    procedure entrada_datos(cl : integer); {Entramos los datos cl posicion}
    var                                    {del array}
      tt, tec : char; {variavles locales solo procedimiento}
      n : integer;
    begin
        writeln('**** Datos Cliente ****');   {toma de datos}
        n := 1;
      repeat      {repetimos asta que lo diga el usuario}
        writeln('  Tipo De Habitacion : ');
        write('  1 = Vip   2 = Triple   3 = Matrimonio');
        repeat    {elegimos la habitacion}
            tec := readkey;  {aqui tomamos la opcion}
        until tec in[#49..#51]; {corresponden a los numeros decimales}
        case tec of             {de las teclas}
     #49 : dahotel[cl].habit[vip].preci[n] := 500;
     #50 : dahotel[cl].habit[triple].preci[n] := 350;
     #51 : dahotel[cl].habit[matrimonio].preci[n] := 250; {ponemos datos}
       end;                                               {elegidos}
    writeln;
    writeln(' Desea Entrar Mas Datos Para Este Cliente [S/N]'); {preguntamos}
    repeat   {esperamos en el bucle}
    tt := upcase(readkey); {esperamos pulsación la tomamos como malluscula}
    until tt in['S','N']; {si es N o S salimos sino no acemos nada y repetimos o lo que es lo mismo }
    if tt = 'S' then       {esperamos}
    begin  {si pulsamos S incrementamos n en 1}
    n := n + 1;
    if n > 35 then  {verificamos que no entramos mas que lo que puede tener el array}
    n := 35;
    end;
    until tt = 'N'; {si se pulso N terminamos}
    dahotel[cl].habit[todo1].nut := n; {asignamos las entradas realizadas}
   clrscr;
   n := 1;  {esta parte lo mismo que la anterior}
   repeat    {pedimos y entramos productos}
       writeln;
       writeln('  Productos ');
 writeln(' 1 = Agua Mineral   2 = Helado   3 = Chocolate   4 = Dentifrico');
 repeat
    tec := readkey;
 until tec in[#49..#52];
   case tec of
 #49 : dahotel[cl].Artic[Agua_Mineral].preci[n] := 5;
 #50 : dahotel[cl].Artic[Helado].preci[n] := 45;
 #51 : dahotel[cl].Artic[Chocolate].preci[n] := 20;
 #52 : dahotel[cl].Artic[Dentrifico].preci[n] := 25;
   end;
    writeln;
    writeln(' Desea Entrar Mas Datos Para Este Cliente [S/N]');
    repeat
    tt := upcase(readkey);
    until tt in['S','N'];
    if tt = 'S' then
    begin
    n := n + 1;
    if n > 95 then
    n := 95;
    end;
  until tt = 'N';
  dahotel[cl].Artic[todo2].nud := n;
  {esta zona es como al anterior solo peticion}
 end;
 
   procedure presentafactura(nn : integer); {aqui presentamos o}
   var                    {imprimimos las factura que marca nn}
      i, t : integer;
   begin
       for i := 1 to  nn do
       begin
          for t := 1 to dahotel[i].habit[todo1].nut do
          if dahotel[i].habit[vip].preci[t] > 0 then
          writeln(' Habitacion Vip = ',dahotel[i].habit[vip].preci[t]);
          if dahotel[i].habit[triple].preci[t] > 0 then
          writeln(' Habitacion Triple = ',dahotel[i].habit[triple].preci[t]);
  if dahotel[i].habit[matrimonio].preci[t] > 0 then
  writeln(' Habitacion matrimonio = ',dahotel[i].habit[matrimonio].preci[t]);
       end;
       for t := 1 to dahotel[i].Artic[todo2].nud do
       begin
  if dahotel[i].Artic[Agua_Mineral].preci[t] > 0 then
 writeln(' Producto Agua_Mineral = ',dahotel[i].Artic[Agua_Mineral].preci[t]);
 if dahotel[i].Artic[Helado].preci[t] > 0 then
 writeln(' Producto Helado = ',dahotel[i].Artic[Helado].preci[t]);
 if dahotel[i].Artic[Chocolate].preci[t] > 0 then
 writeln(' Producto Chocolate = ',dahotel[i].Artic[Chocolate].preci[t]);
 if dahotel[i].Artic[Dentrifico].preci[t] > 0 then
 writeln(' Producto Dentrifico = ',dahotel[i].Artic[Dentrifico].preci[t]);
       end;
    writeln;
    writeln('  Pulse [Enter]');
    readln;
   end;
  {impresion en pantalla de los datos entrados para este cliente nn}
 
   begin
       clrscr;   {borrado de pantalla}
       cli := 1;  {asignamos primer cliente}
       entrada_datos(cli);  {entramos los datos}
       clrscr; {borramos pantalla}
       presentafactura(cli); {presentamos resultados}
   end.


mira esto te ayudara primero cuando sale esa pantalla solo estera pulses 1 2 o 3 y automática
mente pasa a la otra pregunta los datos ya los cargo si le das si te bol vera a presentar la misma
pantalla si das n saldar a lo siguiente
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 31/01/2013 04:00:36
muy bien explicado amigo tengo algunas dudas pero mañana te las hago llegar ahora mi pregunta tu corriste el programa? ya ahora es tarde yo mañana temprano lo compilo a ver si me corre y te hago saber cualkier duda te la comunico por mi parte muy agradecido men tus conocimientos son muy utiles para mi y espero sigas ayudandome mil gracias.
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 31/01/2013 16:51:39
amigo malas noticias el programa no funciona bien cuando compilo que escojo el tipo de habitacion deberia salirme el precio de la habitacion y la cantidad y solo me sale desean entrar mas datos? y al darle a la tecla n deberia devolverme al codigo fuente ps no hace nada se keda hay tiene un problema serio jeje sale igual a la imagen que subi anteriormente al darle "s" deberia continuar y no lo hace o al darle "n" deberia terminar tampoco lo hace simplemente de queda hasta hay el programa
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por ramon (2158 intervenciones) el 31/01/2013 17:43:58
A ver el programa esta comprobado en turbo pascal 7.0 y trabaja perfectamente pero eso no quita
que por algún motivo te este fallando.
Cuanto pulsas el tipo de habitación no te presentara ningún dato puesto que tu le as pedido uno
de los que te presenta por lo cual ya lo as visto.
Pasa a preguntar si quieres mas habitaciones o no tienes que pulsar S o N solo si pulsas S
te presentara lo mismo de antes las habitaciones si no te presentara la siguiente entrada.
que como la anterior te pedirá que quieres entrar y luego si quieres entrar mas o no después
te presenta los resultados de la entrada.

Esto esta funcionando mira marca el programa y copia y luego lo pegas en el bloc de notas
y lo guardas donde tengas el pascal con extensión pas no txt.
algunas veces falla porque al cogerlo algo copio mal.
Ya comentaras.
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 31/01/2013 18:58:48

bien aki en esta parte me muestra los datos de la factura anterior encima de los datos del cliente deberia hacer eso ? guardar esos datos de la factura?

aki en esta parte me gustaria que me dijera "ingrese los datos del cliente" o algo asi ya que solo sale "DATOS DEL CLIENTE" pero que cliente? xD

en esta parte escojiendo habitaciones deberia salirme al final en la factura cuantas habitaciones escoji la cantidad y el precio porque si escojo todas al final solo me sale la vip y su valor, por ejemplo escojo la vip luego le doy s y escojo la triple y luego doy s y escojo la matrimonial deberia reflejar la factura las 3 habitaciones que escoji solo me sale vip y matrimonial faltaria la triple

igual con esta al escojer todos los productos solo me salen al final agua mineral y dentrifico
bueno ayudame hay jeje te cuento que le agregue un readkey despues de "presentafactura(cli);" y fue que me andubo
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 31/01/2013 19:57:19
jejeje amigo me hubieras dicho eso antes jeje ya lo copie y ps me andubo bien lo unico que tiene es que quiero que pueda darme opcion a ingresar los datos del cliente y ps falla la habitacion triple que no aparece en la factura, a ver si es posible que el programa saque el total de lo que debe pagar el cleinte al final de la factura por ejemplo
" el cliente carlos reservo tales habitaciones y compro tantos productos el total a pagar es :"
mas o menos asi asi podria yo pedirle el nombre al usuario para quesalga en la factura hay espero respuesta mil gracias por lo que me has ayudado jeje
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por ramon (2158 intervenciones) el 31/01/2013 20:06:25
Mira esta probado otra ved y funciona sin problema esta asta en feepascal 6.4 y va bien rebisa
con cuidado lo que copias.
Si te da problemas cambia readkey por readln.

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
program hotel;
   uses
      crt;
   type
      habitacion = (Vip,Triple,Matrimonio,todo1); {Tipo de Conjunto}
      productos = (Agua_Mineral,Helado,Chocolate,Dentrifico,todo2);
      reghotel = record  {Registro de los datos a manejar}
            habit : array[habitacion] of record {Registro de habitacionas}
                                    preci : array[1..35] of word;
                                    nut : integer;
                                    end;
            Artic : array[productos] of record  {Registro de productos}
                                   preci : array[1..95] of word;
                                   nud : integer;
                                  end;
                                end;
    {Estos son registros dentro del registro general}
    var
       dahotel : array[1..12] of reghotel; {Un variable array de 12 registros}
       cli : integer;  {variable apuntadora para el array}
 
    procedure entrada_datos(cl : integer); {Entramos los datos cl posicion}
    var                                    {del array}
      tt, tec : char; {variavles locales solo procedimiento}
      n : integer;
    begin
        writeln('**** Datos Cliente ****');   {toma de datos}
        n := 1;
      repeat      {repetimos asta que lo diga el usuario}
        writeln('  Tipo De Habitacion : ');
        write('  1 = Vip   2 = Triple   3 = Matrimonio');
        repeat    {elegimos la habitacion}
            tec := readkey;
        until tec in[#49..#51]; {corresponden a los numeros decimales}
        case tec of             {de las teclas}
     #49 : dahotel[cl].habit[vip].preci[n] := 500;
     #50 : dahotel[cl].habit[triple].preci[n] := 350;
     #51 : dahotel[cl].habit[matrimonio].preci[n] := 250; {ponemos datos}
       end;                                               {elegidos}
    writeln;
    writeln(' Desea Entrar Mas Datos Para Este Cliente [S/N]');
    repeat   {preguntamos si sige}
    tt := upcase(readkey);
    until tt in['S','N'];
    if tt = 'S' then
    begin
    n := n + 1;
    if n > 35 then
    n := 35;
    end;
    until tt = 'N';
    dahotel[cl].habit[todo1].nut := n; {asignamos las entradas realizadas}
   clrscr;
   n := 1;
   repeat    {pedimos y entramos productos}
       writeln;
       writeln('  Productos ');
 writeln(' 1 = Agua Mineral   2 = Helado   3 = Chocolate   4 = Dentifrico');
 repeat
    tec := readkey;
 until tec in[#49..#52];
   case tec of
 #49 : dahotel[cl].Artic[Agua_Mineral].preci[n] := 5;
 #50 : dahotel[cl].Artic[Helado].preci[n] := 45;
 #51 : dahotel[cl].Artic[Chocolate].preci[n] := 20;
 #52 : dahotel[cl].Artic[Dentrifico].preci[n] := 25;
   end;
    writeln;
    writeln(' Desea Entrar Mas Datos Para Este Cliente [S/N]');
    repeat
    tt := upcase(readkey);
    until tt in['S','N'];
    if tt = 'S' then
    begin
    n := n + 1;
    if n > 95 then
    n := 95;
    end;
  until tt = 'N';
  dahotel[cl].Artic[todo2].nud := n;
  {esta zona es como al anterior solo peticion}
 end;
 
   procedure presentafactura(nn : integer); {aqui presentamos o}
   var                    {imprimimos las factura que marca nn}
      i, t : integer;
   begin
       for i := 1 to  nn do
       begin
          for t := 1 to dahotel[i].habit[todo1].nut do
          begin
          if dahotel[i].habit[vip].preci[t] > 0 then
          writeln(' Habitacion Vip = ',dahotel[i].habit[vip].preci[t]);
          if dahotel[i].habit[triple].preci[t] > 0 then
          writeln(' Habitacion Triple = ',dahotel[i].habit[triple].preci[t]);
  if dahotel[i].habit[matrimonio].preci[t] > 0 then
  writeln(' Habitacion matrimonio = ',dahotel[i].habit[matrimonio].preci[t]);
       end;
       for t := 1 to dahotel[i].Artic[todo2].nud do
       begin
  if dahotel[i].Artic[Agua_Mineral].preci[t] > 0 then
 writeln(' Producto Agua_Mineral = ',dahotel[i].Artic[Agua_Mineral].preci[t]);
 if dahotel[i].Artic[Helado].preci[t] > 0 then
 writeln(' Producto Helado = ',dahotel[i].Artic[Helado].preci[t]);
 if dahotel[i].Artic[Chocolate].preci[t] > 0 then
 writeln(' Producto Chocolate = ',dahotel[i].Artic[Chocolate].preci[t]);
 if dahotel[i].Artic[Dentrifico].preci[t] > 0 then
 writeln(' Producto Dentrifico = ',dahotel[i].Artic[Dentrifico].preci[t]);
       end;
     end;
    writeln;
    writeln('  Pulse [Enter]');
    readln;
   end;
  {impresion en pantalla de los datos entrados para este cliente nn}
 
   begin
       clrscr;   {borrado de pantalla}
       cli := 1;  {asignamos primer cliente}
       entrada_datos(cli);  {entramos los datos}
       clrscr; {borramos pantalla}
       presentafactura(cli); {presentamos resultados}
   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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 31/01/2013 20:27:50
ya eh copiado y revisado al pelo jeje pero como te digo yo uso turbopascal7.0 y el programa anda pero el bucle n+1 en las habitaciones solo funciona con la habitacion vip con triple y matrimonio no anda si escojo 5 veces la opcion 1 en habitaciones si me salen 5 vip en la factura pero si escojo 5 triple o 5 matrimonio solo me da 1 con los productos va bien el q escoja las veces q lo escoja me lanza el resultado esperado pero con las habitaciones no jeje y veo que tienen el mismo bucle por eso no entiendo porq falla, y pues con lo otro que te comente a ver si es posible que el programa saque el total de lo que debe pagar el cleinte al final de la factura por ejemplo
" el cliente carlos reservo tales habitaciones y compro tantos productos el total a pagar es :"
mas o menos asi asi podria yo pedirle el nombre al usuario para quesalga en la factura hay espero respuesta mil gracias por lo que me has ayudado jeje
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por ramon (2158 intervenciones) el 01/02/2013 20:00:19
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
{Yo trabajo con pascal 7.0 y funciona bien no octante te paso este pequeño programa para que chequees tu teclado para ver los códigos o sea los números que te entrega una vez arrancado
pulsa las teclas y veras el código si aprecias cambio modifica los valores.
También te e corregido el programa y te e insertado el total prueba lo.
 
program teclado;
uses
   crt, dos;
   var
       tecla : char;
       x, y, nume : integer;
   begin
   clrscr;
   sound(100);
   delay(129);
   nosound;
   x := 3;
   y := 3;
   nume := 9;
   repeat
       textcolor(14);
       gotoxy(x,y);write(nume);
       textcolor(15);
       gotoxy(x + 4,y);write(tecla);
       inc(nume);
       tecla := chr(nume);
       inc(y,1);
       if y > 25 then
       begin
           y := 3;
           x := x + 7;
       end;
   until nume > 254;
   gotoxy(4,27);
   write('pulse una tecla o [ESC] Salir : ');
   repeat
      gotoxy(38,27);
      tecla := readkey;
      if tecla = #0 then
      begin
      tecla := readkey;
      gotoxy(38,27);clreol;
      gotoxy(38,27);
      write('#',ord(tecla),' ',chr(26),' Caracter : ',tecla);
      end
   else
      begin
          gotoxy(38,27);clreol;
          gotoxy(38,27);
          write('#',ord(tecla),' ',chr(26),' Caracter : ',tecla);
      end;
   until tecla = #27;
   end.
 
 
 
 
 
 program hotel;
   uses
      crt;
   type
      habitacion = (Vip,Triple,Matrimonio,todo1); {Tipo de Conjunto}
      productos = (Agua_Mineral,Helado,Chocolate,Dentrifico,todo2);
      reghotel = record  {Registro de los datos a manejar}
            habit : array[habitacion] of record {Registro de habitacionas}
                                    preci : array[1..35] of word;
                                    nut : integer;
                                    end;
            Artic : array[productos] of record  {Registro de productos}
                                   preci : array[1..95] of word;
                                   nud : integer;
                                  end;
                                end;
    {Estos son registros dentro del registro general}
    var
       dahotel : array[1..12] of reghotel; {Un variable array de 12 registros}
       cli : integer;  {variable apuntadora para el array}
 
    procedure entrada_datos(cl : integer); {Entramos los datos cl posicion}
    var                                    {del array}
      tt, tec : char; {variavles locales solo procedimiento}
      n : integer;
    begin
        writeln('**** Datos Cliente ****');   {toma de datos}
        n := 1;
      repeat      {repetimos asta que lo diga el usuario}
        writeln('  Tipo De Habitacion : ');
        write('  1 = Vip   2 = Triple   3 = Matrimonio');
        repeat    {elegimos la habitacion}
            tec := readkey;
        until tec in['1'..'3']; {corresponden a los numeros decimales}
        case tec of             {de las teclas}
     '1' : dahotel[cl].habit[vip].preci[n] := 500;
     '2' : dahotel[cl].habit[triple].preci[n] := 350;
     '3' : dahotel[cl].habit[matrimonio].preci[n] := 250; {ponemos datos}
       end;                                               {elegidos}
    writeln;
    writeln(' Desea Entrar Mas Datos Para Este Cliente [S/N]');
    repeat   {preguntamos si sige}
    tt := upcase(readkey);
    until tt in['S','N'];
    if tt = 'S' then
    begin
    n := n + 1;
    if n > 35 then
    n := 35;
    end;
    until tt = 'N';
    dahotel[cl].habit[todo1].nut := n; {asignamos las entradas realizadas}
   clrscr;
   n := 1;
   repeat    {pedimos y entramos productos}
       writeln;
       writeln('  Productos ');
 writeln(' 1 = Agua Mineral   2 = Helado   3 = Chocolate   4 = Dentifrico');
 repeat
    tec := readkey;
 until tec in[#49..#52];
   case tec of
 #49 : dahotel[cl].Artic[Agua_Mineral].preci[n] := 5;
 #50 : dahotel[cl].Artic[Helado].preci[n] := 45;
 #51 : dahotel[cl].Artic[Chocolate].preci[n] := 20;
 #52 : dahotel[cl].Artic[Dentrifico].preci[n] := 25;
   end;
    writeln;
    writeln(' Desea Entrar Mas Datos Para Este Cliente [S/N]');
    repeat
    tt := upcase(readkey);
    until tt in['S','N'];
    if tt = 'S' then
    begin
    n := n + 1;
    if n > 95 then
    n := 95;
    end;
  until tt = 'N';
  dahotel[cl].Artic[todo2].nud := n;
  {esta zona es como al anterior solo peticion}
 end;
 
   procedure presentafactura(nn : integer); {aqui presentamos o}
   var                    {imprimimos las factura que marca nn}
      i, t : integer;
      total : real;
   begin
       total := 0;
       for i := 1 to  nn do
       begin
          for t := 1 to dahotel[i].habit[todo1].nut do
          begin
          if dahotel[i].habit[vip].preci[t] > 0 then
          begin
          writeln(' Habitacion Vip = ',dahotel[i].habit[vip].preci[t]);
          total := total + dahotel[i].habit[vip].preci[t];
          end;
          if dahotel[i].habit[triple].preci[t] > 0 then
          begin
          writeln(' Habitacion Triple = ',dahotel[i].habit[triple].preci[t]);
          total := total + dahotel[i].habit[triple].preci[t];
          end;
  if dahotel[i].habit[matrimonio].preci[t] > 0 then
  begin
  writeln(' Habitacion matrimonio = ',dahotel[i].habit[matrimonio].preci[t]);
  total := total + dahotel[i].habit[matrimonio].preci[t];
  end;
       end;
       for t := 1 to dahotel[i].Artic[todo2].nud do
       begin
  if dahotel[i].Artic[Agua_Mineral].preci[t] > 0 then
  begin
 writeln(' Producto Agua_Mineral = ',dahotel[i].Artic[Agua_Mineral].preci[t]);
 total := total + dahotel[i].Artic[Agua_Mineral].preci[t];
 end;
 if dahotel[i].Artic[Helado].preci[t] > 0 then
 begin
 writeln(' Producto Helado = ',dahotel[i].Artic[Helado].preci[t]);
 total := total + dahotel[i].Artic[Helado].preci[t];
 end;
 if dahotel[i].Artic[Chocolate].preci[t] > 0 then
 begin
 writeln(' Producto Chocolate = ',dahotel[i].Artic[Chocolate].preci[t]);
 total := total + dahotel[i].Artic[Chocolate].preci[t];
 end;
 if dahotel[i].Artic[Dentrifico].preci[t] > 0 then
 begin
 writeln(' Producto Dentrifico = ',dahotel[i].Artic[Dentrifico].preci[t]);
 total := total + dahotel[i].Artic[Dentrifico].preci[t];
   end;
  end;
 end;
    writeln(' El Importe Total Es : ',total:12:2);
    writeln;
    writeln('  Pulse [Enter]');
    readln;
   end;
  {impresion en pantalla de los datos entrados para este cliente nn}
 
   begin
       clrscr;   {borrado de pantalla}
       cli := 1;  {asignamos primer cliente}
       entrada_datos(cli);  {entramos los datos}
       clrscr; {borramos pantalla}
       presentafactura(cli); {presentamos resultados}
   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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 02/02/2013 20:18:13
hola amigo muy bien jeje de verdad mil gracias lo unico que no entendi fue esta partecita " until tec in['1'..'3']; {corresponden a los numeros decimales} case tec of {de las teclas}" osea que decimales si no eh visto ninguno jeje
esta parte tampoco la entendi muy bien
until tec in[#49..#52]; case tec of
#49 : dahotel[cl].Artic[Agua_Mineral].preci[n] := 5;
#50 : dahotel[cl].Artic[Helado].preci[n] := 45;
#51 : dahotel[cl].Artic[Chocolate].preci[n] := 20;
#52 : dahotel[cl].Artic[Dentrifico].preci[n] := 25;
end;
ese arreglo de que se trata? osea entiendo la estructura pero al ver estos simbolos "#" me confundo no se de que se tratan jeje

y pues el programa ahora si que corre muy bien con el total y todo de verdad mil gracias eres un exelente colaborador aparte de muy buena persona dios te compensara amigo jeje
otra cosita jeje si es posible para ti como seria el diagrama de flujo de este programote? jeje aver si me podes ayudar hay jeje mil gracias otra vez saludos.
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por ramon (2158 intervenciones) el 02/02/2013 23:09:39
Los símbolo #y el numero corresponden al valor de la tecla que as pulsado 1,2,3 .
Como podrás ver en el programa que te pase con esto para que vieras esos valores de las teclas.
La parte until tec in['1','2','3'] corresponde a una forma de comprobación de pascal booleana.
Y fíjate que los números están entre comas indica carácter no numero.
Respecto al diagrama de flujo intentare hacer algo.
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 02/02/2013 23:42:16
BUENA EXPLICACION te agradezco ahora si estoy listo para la expo y ademas aprendi un poco mas sobre ese lenguaje muchisima gracias espero tu respuesta con repecto al diagrama.
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por ramon (2158 intervenciones) el 05/02/2013 19:29:20
Espero lo entiendas e intentado en grafico pero no veo lo aya tomado lo paso en texto

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
{                                 Principio
                                  ____________
                                 (____________)
                                        |
                                        |
                                 --------------
                                |  Entrada 1   |--
                                 --------------  |
                                        |        |
                                       /\        |
                               _______/  \_______|
                              | no    \  /  si
                              |        \/
                              |     decision
                              |  --------------
                              --|  Entrada 2   |--
                                 --------------  |
                                       |         |
                                       /\        |
                               _______/  \_______|
                              | no    \  /   si
                              |        \/
                              |     decision
                              |     ______________
                              |_ __|    presenta  |
                                   |  Resultados  |
                                    --------------
                                          |
                                          |
                                     -----------
                                    (    fin    )
                                     -----------}
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por cristhian (12 intervenciones) el 06/02/2013 16:19:35
oye amigo pero solo esta la estructura pero hay que rellenar esas casillas xd y no se que va dentro jeje pero hazlo en imagen y subelo como imagen porfas
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

CRISTHIAN ( NESECITO AYUDA PARA HACER UN PROGRAMA TURBO PASCAL )

Publicado por ramon (2158 intervenciones) el 06/02/2013 21:24:46
Es el diagrama lo demás a que te refieres las casillas están completas.

Principio
____________ inicio
(____________) clrscr; {borrado de pantalla}
cli := 1; {asignamos primer cliente}
|
|
--------------
| Entrada 1 |-- 1º entrada_datos(cli);
-------------- |
| |
/\ |
_______/ \_______| el repeat until
| no \ / si
| \/
| decision
| --------------
--| Entrada 2 |-- 2º entrada_datos(cli);
-------------- |
| |
/\ |
_______/ \_______| el repeat until
| no \ / si
| \/
| decision
| ______________
|_ __| presenta |
| Resultados | presentafactura(cli)
--------------
|
|
-----------
( fin ) salir
-----------

que otra cosa quieres.
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