Pascal/Turbo Pascal - ayuda para crear un programa con menu

 
Vista:

ayuda para crear un programa con menu

Publicado por nehemias (1 intervención) el 01/08/2011 05:25:56
si alguien hizo un programa en turbo Pascal TPX En dond permita resolver los diez casos y casos especiales del algebra de baldor realizando un menu donde se pueda seleccionar el caso y caso especial en version 7.0
buenisima onda si me lo pudieran mandar me urge [email protected]
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

ayuda para crear un programa con menu

Publicado por ramon (2158 intervenciones) el 02/08/2011 13:55:53
{te dejo el menú para ejecutar lo que quieres los procedimientos y funciones que desees ejecutar
las tendrás que crear como te marca lo echo en el menú espero te sirva suerte}

program Menu_Alg;
uses
crt;
var
tecla : char;
opcion, x, y, i : integer;
salir : boolean;
dato1, dato2 : real;


procedure opcionesmenu(xm, ym : integer);
begin
textcolor(15);
gotoxy(xm - 8,ym - 2);write('*** Menu Algebra de Baldor ***');
gotoxy(xm,ym);write('Opcion N§ 1');
gotoxy(xm,ym + 2);write('Opcion N§ 2');
gotoxy(xm,ym + 4);write('Opcion N§ 3');
gotoxy(xm,ym + 6);write('Opcion N§ 4');
gotoxy(xm,ym + 8);write('Opcion N§ 5');
gotoxy(xm,ym + 10);write('Opcion N§ 6');
gotoxy(xm,ym + 12);write('Opcion N§ 7');
gotoxy(xm,ym + 14);write('Opcion N§ 8');
gotoxy(xm,ym + 16);write('Opcion N§ 9');
gotoxy(xm,ym + 18);write('Opcion N§ 10');
gotoxy(xm,ym + 20);write('Opcion Salir');
end;

procedure marcador(xx, yy : integer; estado : boolean);
begin
if estado = true then
begin
gotoxy(xx - 1,yy - 1);write('---------------');
gotoxy(xx - 2,yy);write('|');
gotoxy(xx + 14,yy);write('|');
gotoxy(xx - 1,yy + 1);write('---------------');
end
else
begin
gotoxy(xx - 1,yy - 1);write(' ');
gotoxy(xx - 2,yy);write(' ');
gotoxy(xx + 14,yy);write(' ');
gotoxy(xx - 1,yy + 1);write(' ');
end;
end;

function numeros(xn,yn : integer) : real;
var
danum : string[12];
error, l : integer;
tec : char;
nume : real;
begin
fillchar(danum,13,' ');
danum[0] := chr(12);
l := 1;
repeat
tec := readkey;
if tec in[#48..#57] then
begin
danum[l] := tec;
danum[0] := chr(l);
gotoxy(xn + l,yn);write(danum[l]);
l := l + 1;
if l > 12 then
l := 12;
end;
if tec = #8 then
begin
l := l - 1;
if l < 1 then
l := 1;
danum[l] := ' ';
danum[0] := chr(l);
gotoxy(xn + l,yn);write(danum[l]);
end;
until tec = #13;
val(danum,nume,error);
numeros := nume;
end;

{procedimientos que se ejecutaran}
procedure opcion1;
var
fin : char;
begin
gotoxy(4,3);write('Un Ejemplo De Muestra Suma De Algebra');
gotoxy(4,5);write('Dato1 : ');
dato1 := numeros(11,5);
gotoxy(4,6);write('Dato2 : ');
dato2 := numeros(11,6);
clrscr;
gotoxy(4,8);write('(dato1 + dato2) = (dato2 + dato1) = ',dato1 + dato2:8:2);
gotoxy(3,23);write('Ejecutando Opcion N§ 1 ** Pulsa Una TECLA **');
repeat
fin := readkey;
until fin in[#00..#12,#14..#126];
end;

procedure opcion2;
begin
gotoxy(3,23);write('Ejecutando Opcion N§ 2 ** Pulsa Una TECLA **');
repeat until keypressed;
end;

procedure opcion3;
begin
gotoxy(3,23);write('Ejecutando Opcion N§ 3 ** Pulsa Una TECLA **');
repeat until keypressed;
end;

procedure opcion4;
begin
gotoxy(3,23);write('Ejecutando Opcion N§ 4 ** Pulsa Una TECLA **');
repeat until keypressed;
end;

procedure opcion5;
begin
gotoxy(3,23);write('Ejecutando Opcion N§ 5 ** Pulsa Una TECLA **');
repeat until keypressed;
end;

procedure opcion6;
begin
gotoxy(3,23);write('Ejecutando Opcion N§ 6 ** Pulsa Una TECLA **');
repeat until keypressed;
end;

procedure opcion7;
begin
gotoxy(3,23);write('Ejecutando Opcion N§ 7 ** Pulsa Una TECLA **');
repeat until keypressed;
end;

procedure opcion8;
begin
gotoxy(3,23);write('Ejecutando Opcion N§ 8 ** Pulsa Una TECLA **');
repeat until keypressed;
end;

procedure opcion9;
begin
gotoxy(3,23);write('Ejecutando Opcion N§ 9 ** Pulsa Una TECLA **');
repeat until keypressed;
end;

procedure opcion10;
begin
gotoxy(3,23);write('Ejecutando Opcion N§ 10 ** Pulsa Una TECLA **');
repeat until keypressed;
end;

procedure menu;
var
pox, poy : integer;
begin
x := 11;
y := 4;
opcionesmenu(x,y);
marcador(x,y,true);
salir := false;
opcion := 1;
repeat
tecla := readkey;
marcador(x,y,false);
if tecla = #72 then
begin
opcion := opcion - 1;
if opcion < 1 then
opcion := 1;
y := y - 2;
if y < 4 then
y := 4;
end;
if tecla = #80 then
begin
opcion := opcion + 1;
if opcion > 11 then
opcion := 11;
y := y + 2;
if y > 24 then
y := 24;
end;
if tecla = #13 then
begin
case opcion of
1 : begin
clrscr;
pox := x;
poy := y;
opcion1; {procedimiento a ejecutar}
clrscr;
x := 11;
y := 4;
opcionesmenu(x,y);
x := pox;
y := poy;
end;
2 : begin
clrscr;
pox := x;
poy := y;
opcion2;
clrscr;
x := 11;
y := 4;
opcionesmenu(x,y);
x := pox;
y := poy;
end;
3 : begin
clrscr;
pox := x;
poy := y;
opcion3;
clrscr;
x := 11;
y := 4;
opcionesmenu(x,y);
x := pox;
y := poy;
end;
4 : begin
clrscr;
pox := x;
poy := y;
opcion4;
clrscr;
x := 11;
y := 4;
opcionesmenu(x,y);
x := pox;
y := poy;
end;
5 : begin
clrscr;
pox := x;
poy := y;
opcion5;
clrscr;
x := 11;
y := 4;
opcionesmenu(x,y);
x := pox;
y := poy;
end;
6 : begin
clrscr;
pox := x;
poy := y;
opcion6;
clrscr;
x := 11;
y := 4;
opcionesmenu(x,y);
x := pox;
y := poy;
end;
7 : begin
clrscr;
pox := x;
poy := y;
opcion7;
clrscr;
x := 11;
y := 4;
opcionesmenu(x,y);
x := pox;
y := poy;
end;
8 : begin
clrscr;
pox := x;
poy := y;
opcion8;
clrscr;
x := 11;
y := 4;
opcionesmenu(x,y);
x := pox;
y := poy;
end;
9 : begin
clrscr;
pox := x;
poy := y;
opcion9;
clrscr;
x := 11;
y := 4;
opcionesmenu(x,y);
x := pox;
y := poy;
end;
10 : begin
clrscr;
pox := x;
poy := y;
opcion10;
clrscr;
x := 11;
y := 4;
opcionesmenu(x,y);
x := pox;
y := poy;
end;
11 : begin
salir := true;
end;
end;
end;
marcador(x,y,true);
until (tecla = #27) or (salir = true);
end;


begin
clrscr;
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