Documente Academic
Documente Profesional
Documente Cultură
PROGRAM FUNCIONES;
USES CRT;
PROCEDURE CUADRATICA;
var
i,b,a:integer;
BEGIN
clrscr;
gotoxy(20,1);
textcolor(15);
writeln('Ecuacion de la forma Y = (x+a)^2 + b');
writeln('');
textcolor(2);
write('Ingrese "a" que se encuente en el intervalo -16<=a<=16 -->');
gotoxy(61,3);
textcolor(15);
write('(
)');
gotoxy(63,3);
readln(a);
writeln('');
textcolor(2);
writeln('Ingrese "b" que se encuentre en el intervalo -10<=b<=7 -->');
gotoxy(61,5);
textcolor(15);
write('(
)');
gotoxy(63,5);
readln(b);
clrscr;
textcolor(2);
writeln('');
writeln(' La ecuacion ingresada');
write(' es ');
textcolor(15);
write('Y = (x+',a,')^2 + ',b);
textcolor(2);
for i:=22 to 59 do
begin
gotoxy(i,12);
write('');
end;
for i:=2 to 23 do
begin
gotoxy(40,i);
writeln('');
end;
for i:=1 to 7 do
begin
gotoxy((5*i)+20,12);
write('');
end;
gotoxy(24,13);
write('-15');
gotoxy(29,13);
write('-10');
gotoxy(34,13);
write('-5');
gotoxy(45,13);
write('5');
gotoxy(50,13);
write('10');
gotoxy(55,13);
write('15');
gotoxy(39,7);
write('5');
gotoxy(38,2);
write('10');
gotoxy(38,17);
write('-5');
gotoxy(37,22);
write('-10');
begin
textcolor(11);
gotoxy(40+i-a,((12-(sqr(i))-b)));
write('*');
delay(500);
end;
end;
end;
end;
END;
PROCEDURE LINEAL;
var
i,b,m:integer;
BEGIN
clrscr;
gotoxy(20,1);
textcolor(15);
writeln('Ecuacion de la forma Y = mx + b');
writeln('');
textcolor(2);
writeln('Ingrese la pendiente "m" que se encuente en el intervalo -5<=m<=5 -->');
textcolor(15);
gotoxy(71,3);
write('( )');
gotoxy(73,3);
readln(m);
writeln('');
textcolor(2);
if (m=0) then
begin
writeln('Ingrese el intercepto "b" que se encuentre en el intervalo -9<=b<=9 -->');
end;
textcolor(15);
gotoxy(73,5);
write('( )');
gotoxy(75,5);
readln(b);
clrscr;
textcolor(2);
writeln('');
writeln(' La ecuacion ingresada');
write(' es ');
textcolor(15);
writeln('Y = ',m,'x + ',b);
textcolor(2);
for i:=22 to 59 do
begin
gotoxy(i,12);
write('');
end;
for i:=2 to 23 do
begin
gotoxy(40,i);
writeln('');
end;
gotoxy(40,12);
write('');
for i:=1 to 7 do
begin
gotoxy((5*i)+20,12);
write('');
end;
begin
gotoxy(24,13);
write('-15');
gotoxy(29,13);
write('-10');
gotoxy(34,13);
write('-5');
gotoxy(45,13);
write('5');
gotoxy(50,13);
write('10');
gotoxy(55,13);
write('15');
gotoxy(39,7);
write('5');
gotoxy(38,2);
write('10');
gotoxy(38,17);
write('-5');
gotoxy(37,22);
write('-10');
end;
if (m=0) then
begin
for i:= 35 to 45 do
begin
textcolor(11);
gotoxy(i,(-b+12));
write('*');
delay(500);
end;
end;
textcolor(11);
gotoxy(34+(i),(((18-i*m)+(6*(m-1)))-b));
write('*');
delay(500);
end;
readkey;
end;
end;
end;
END;
PROCEDURE CUBICA;
var
i,b,a:integer;
BEGIN
clrscr;
gotoxy(20,1);
textcolor(15);
writeln('Ecuacion de la forma Y = (x+a)^3 + b');
writeln('');
textcolor(2);
writeln('Ingrese "a" que se encuente en el intervalo -16<=a<=16 -->');
textcolor(15);
gotoxy(60,3);
write('(
)');
gotoxy(62,3);
readln(a);
writeln('');
textcolor(2);
writeln('Ingrese "b" que se encuentre en el intervalo -3<=b<=3 -->');
textcolor(15);
gotoxy(59,5);
write('( )');
gotoxy(61,5);
readln(b);
textcolor(2);
clrscr;
writeln('');
writeln(' La ecuacion ingresada');
write(' es ');
textcolor(15);
writeln('Y = (x+',a,')^3 + ',b);
textcolor(2);
for i:=22 to 59 do
begin
gotoxy(i,12);
write('');
end;
for i:=2 to 23 do
begin
gotoxy(40,i);
writeln('');
end;
gotoxy(40,12);
write('');
for i:=1 to 7 do
begin
gotoxy((5*i)+20,12);
write('');
end;
gotoxy(24,13);
write('-15');
gotoxy(29,13);
write('-10');
gotoxy(34,13);
write('-5');
gotoxy(45,13);
write('5');
gotoxy(50,13);
write('10');
gotoxy(55,13);
write('15');
gotoxy(39,7);
write('5');
gotoxy(38,2);
write('10');
gotoxy(38,17);
write('-5');
gotoxy(37,22);
write('-10');
PROCEDURE LOGARITMO;
var
a,i:integer;
BEGIN
clrscr;
gotoxy(20,1);
textcolor(15);
writeln('Ecuacion de la forma Y = ln(ax)');
writeln('');
textcolor(2);
writeln('Ingrese "a" que se encuente en el intervalo -2<=a<=2 -->');
textcolor(15);
gotoxy(58,3);
write('( )');
gotoxy(60,3);
readln(a);
textcolor(2);
clrscr;
writeln(' La ecuacion ingresada');
write(' es ');
textcolor(15);
writeln('Y = ln(',a,'x)');
textcolor(2);
If a=0 then
begin
gotoxy(22,12);
write('Es una funcion indefinida');
end;
If (a>0) then
begin
for i:=18 to 74 do
begin
gotoxy(i,12);
write('');
end;
for i:=2 to 23 do
begin
gotoxy(22,i);
writeln('');
end;
gotoxy(22,12);
writeln('');
gotoxy(32,12);
writeln('');
gotoxy(32,13);
write('1');
gotoxy(42,12);
writeln('');
gotoxy(42,13);
write('2');
gotoxy(52,12);
writeln('');
gotoxy(52,13);
write('3');
gotoxy(62,12);
writeln('');
gotoxy(62,13);
write('4');
gotoxy(72,12);
writeln('');
gotoxy(72,13);
write('5');
end;
If (a<0) then
begin
for i:=18 to 74 do
begin
gotoxy(i,12);
write('');
end;
for i:=2 to 23 do
begin
gotoxy(72,i);
writeln('');
end;
gotoxy(22,12);
writeln('');
gotoxy(21,13);
write('-5');
gotoxy(32,12);
writeln('');
gotoxy(31,13);
write('-4');
gotoxy(42,12);
writeln('');
gotoxy(41,13);
write('-3');
gotoxy(52,12);
writeln('');
gotoxy(51,13);
write('-2');
gotoxy(62,12);
writeln('');
gotoxy(61,13);
write('-1');
gotoxy(72,12);
writeln('');
gotoxy(22,12);
writeln('');
end;
If a=1 then
begin
textcolor(11);
gotoxy(23,22);
write('*');
gotoxy(23,21);
write('*');
gotoxy(24,19);
write('*');
gotoxy(25,17);
write('*');
gotoxy(27,15);
write('*');
gotoxy(29,13);
write('*');
gotoxy(32,12);
write('*');
gotoxy(36,11);
write('*');
gotoxy(42,10);
write('*');
gotoxy(52,9);
writeln('*');
gotoxy(60,8);
writeln('*');
gotoxy(74,7);
writeln('*');
textcolor(2);
gotoxy(21,9);
write('1');
gotoxy(21,6);
write('2');
gotoxy(21,3);
write('3');
gotoxy(20,15);
write('-1');
gotoxy(20,18);
write('-2');
gotoxy(20,21);
write('-3');
delay(500);
end;
If a=-1 then
begin
textcolor(11);
gotoxy(((2)*(47-23)+23),22);
write('*');
gotoxy(((2)*(47-23)+23),21);
write('*');
gotoxy(((2)*(47-24)+24),19);
write('*');
gotoxy(((2)*(47-25)+25),17);
write('*');
gotoxy(((2)*(47-27)+27),15);
write('*');
gotoxy(((2)*(47-29)+29),13);
write('*');
gotoxy(((2)*(47-32)+32),12);
write('*');
gotoxy(((2)*(47-36)+36),11);
write('*');
gotoxy(((2)*(47-42)+42),10);
write('*');
gotoxy(((2)*(47-52)+52),9);
writeln('*');
gotoxy(((2)*(47-60)+60),8);
writeln('*');
gotoxy(((2)*(47-74)+74),7);
writeln('*');
textcolor(2);
gotoxy(75,9);
write('1');
gotoxy(75,6);
write('2');
gotoxy(75,3);
write('3');
gotoxy(74,15);
write('-1');
gotoxy(74,18);
write('-2');
gotoxy(74,21);
write('-3');
delay(500);
end;
if a=2 then
begin
textcolor(11);
gotoxy(23,18);
write('*');
gotoxy(23,17);
write('*');
gotoxy(24,15);
write('*');
gotoxy(25,13);
write('*');
gotoxy(27,12);
write('*');
gotoxy(29,11);
write('*');
gotoxy(32,10);
write('*');
gotoxy(37,9);
write('*');
gotoxy(41,8);
writeln('*');
gotoxy(48,7);
writeln('*');
gotoxy(59,6);
writeln('*');
gotoxy(73,5);
writeln('*');
textcolor(2);
gotoxy(21,9);
write('1');
gotoxy(21,6);
write('2');
gotoxy(21,3);
write('3');
gotoxy(20,15);
write('-1');
gotoxy(20,18);
write('-2');
gotoxy(20,21);
write('-3');
delay(500);
end;
if a=-2 then
begin
textcolor(11);
gotoxy(((2)*(47-23)+23),18);
write('*');
gotoxy(((2)*(47-23)+23),17);
write('*');
gotoxy(((2)*(47-24)+24),15);
write('*');
gotoxy(((2)*(47-25)+25),13);
write('*');
gotoxy(((2)*(47-27)+27),12);
write('*');
gotoxy(((2)*(47-29)+29),11);
write('*');
gotoxy(((2)*(47-32)+32),10);
write('*');
gotoxy(((2)*(47-37)+37),9);
write('*');
gotoxy(((2)*(47-41)+41),8);
writeln('*');
gotoxy(((2)*(47-48)+48),7);
writeln('*');
gotoxy(((2)*(47-59)+59),6);
writeln('*');
gotoxy(((2)*(47-73)+73),5);
writeln('*');
textcolor(2);
gotoxy(75,9);
write('1');
gotoxy(75,6);
write('2');
gotoxy(75,3);
write('3');
gotoxy(74,15);
write('-1');
gotoxy(74,18);
write('-2');
gotoxy(74,21);
write('-3');
delay(500);
end;
END;
PROCEDURE COSENO;
var
i,b,a:integer;
BEGIN
clrscr;
gotoxy(20,1);
textcolor(15);
writeln('Ecuacion de la forma Y = a*cos(bx)');
writeln('');
textcolor(2);
writeln('Ingrese "a" que se encuente en el intervalo 0<=a<=2 -->');
textcolor(15);
gotoxy(57,3);
write('( )');
gotoxy(59,3);
readln(a);
writeln('');
textcolor(2);
writeln('Ingrese "b" que se encuentre en el intervalo -2<=b<=2 -->');
textcolor(15);
gotoxy(59,5);
write('( )');
gotoxy(61,5);
readln(b);
textcolor(2);
clrscr;
writeln('');
writeln(' La ecuacion ingresada');
write(' es ');
textcolor(15);
writeln('Y =',a,'*cos(',b,'x)');
textcolor(2);
for i:= 4 to 76 do
begin
gotoxy(i,12);
write('');
end;
for i:= 1 to 23 do
begin
gotoxy(40,i);
writeln('');
end;
for i:= 1 to 15 do
begin
gotoxy(5*i,12);
write('');
end;
if (a=0) then
for i:= 1 to 13 do
begin
textcolor(11);
gotoxy(33+i,12);
write('*');
end;
gotoxy(50,13);
write('2');
gotoxy(55,13);
write('3');
gotoxy(60,13);
write('4');
gotoxy(65,13);
write('5');
gotoxy(70,13);
write('6');
gotoxy(75,13);
write('7');
gotoxy(34,13);
write('-1');
gotoxy(29,13);
write('-2');
gotoxy(24,13);
write('-3');
gotoxy(19,13);
write('-4');
gotoxy(14,13);
write('-5');
gotoxy(9,13);
write('-6');
gotoxy(4,13);
write('-7');
end;
if (a=2) then
begin
textcolor(2);
gotoxy(38,7);
write('2');
gotoxy(38,2);
write('4');
gotoxy(37,17);
write('-2');
gotoxy(37,22);
write('-4');
end;
if (a=1) then
begin
textcolor(2);
gotoxy(38,7);
write('1');
gotoxy(38,2);
write('2');
gotoxy(37,17);
write('-1');
gotoxy(37,22);
write('-2');
end;
write('*');
gotoxy(46,10);
write('*');
gotoxy(47,11);
write('*');
gotoxy(48,12);
write('*');
gotoxy(49,13);
write('*');
gotoxy(50,14);
write('*');
gotoxy(51,15);
write('*');
gotoxy(53,16);
write('*');
gotoxy(55,17);
write('*');
gotoxy(56,17);
write('*');
gotoxy(57,2*(12-7)+7);
write('*');
gotoxy(59,2*(12-8)+8);
write('*');
gotoxy(61,2*(12-9)+9);
write('*');
gotoxy(62,2*(12-10)+10);
write('*');
gotoxy(63,2*(12-11)+11);
write('*');
gotoxy(64,2*(12-12)+12);
write('*');
gotoxy(65,2*(12-13)+13);
write('*');
gotoxy(66,2*(12-14)+14);
write('*');
gotoxy(67,2*(12-15)+15);
write('*');
gotoxy(69,2*(12-16)+16);
write('*');
gotoxy(71,2*(12-17)+17);
write('*');
gotoxy(2*(40-41)+41,7);
write('*');
gotoxy(2*(40-43)+43,8);
write('*');
gotoxy(2*(40-45)+45,9);
write('*');
gotoxy(2*(40-46)+46,10);
write('*');
gotoxy(2*(40-47)+47,11);
write('*');
gotoxy(2*(40-48)+48,12);
write('*');
gotoxy(2*(40-49)+49,13);
write('*');
gotoxy(2*(40-50)+50,14);
write('*');
gotoxy(2*(40-51)+51,15);
write('*');
gotoxy(2*(40-53)+53,16);
write('*');
gotoxy(2*(40-55)+55,17);
write('*');
gotoxy(2*(40-56)+56,17);
write('*');
gotoxy(2*(40-57)+57,2*(12-7)+7);
write('*');
gotoxy(2*(40-59)+59,2*(12-8)+8);
write('*');
gotoxy(2*(40-61)+61,2*(12-9)+9);
write('*');
gotoxy(2*(40-62)+62,2*(12-10)+10);
write('*');
gotoxy(2*(40-63)+63,2*(12-11)+11);
write('*');
gotoxy(2*(40-64)+64,2*(12-12)+12);
write('*');
gotoxy(2*(40-65)+65,2*(12-13)+13);
write('*');
gotoxy(2*(40-66)+66,2*(12-14)+14);
write('*');
gotoxy(2*(40-67)+67,2*(12-15)+15);
write('*');
gotoxy(2*(40-69)+69,2*(12-16)+16);
write('*');
gotoxy(2*(40-71)+71,2*(12-17)+17);
write('*');
end;
END;
VAR
op:char;
n:integer;
BEGIN
clrscr;
REPEAT
clrscr;
textcolor(2);
writeln('');
textcolor(15);
write('1.');
textcolor(2);
writeln(' Y = (x+a)^2 + b');
writeln('');
textcolor(15);
write('2.');
textcolor(2);
writeln(' Y = mx + b');
writeln('');
textcolor(15);
write('3.');
textcolor(2);
writeln(' Y = (x+a)^3 + b');
writeln('');
textcolor(15);
write('4.');
textcolor(2);
writeln(' Y = ln(ax)');
writeln('');
textcolor(15);
write('5.');
textcolor(2);
writeln(' Y = a*cos(bx)');
gotoxy(18,13);
writeln('ESCRIBA EL # DE LA FUNCION QUE DESEA GRAFICAR');
gotoxy(32,15);
write('FUNCION #');
textcolor(15);
write(' ( )');
gotoxy(44,15);
read(n);
textcolor(2);
clrscr;
IF n=1 THEN
CUADRATICA;
IF n=2 THEN
LINEAL;
IF n=3 THEN
CUBICA;
IF n=4 THEN
LOGARITMO;
IF n=5 THEN
COSENO;
textcolor(15);
gotoxy(1,24);
writeln('Para graficar otra funcion presione "o" y para salir presione "s" -->');
gotoxy(71,24);
write('(');
gotoxy(75,24);
write(')');
gotoxy(73,24);
readln(op);
UNTIL op='s';
END.