DIDÁCTICA DE LA EDUCACIÓN SUPERIOR- DR LENIN CARI MOGROVEJO
Programación de la calculadora2
1. Programación de la calculadora
// Programado por Grupo Aglodavaci
program Calculadora;
uses crt;
var
a:real;
b:real;
r:real;
Ding: integer;
op, res:char;
begin // *** Programa Principal ***
repeat
textcolor(yellow);
writeln(' *******************************************************');
textcolor(magenta);
writeln(' * __ __ | __ | __ __| __ __ __ *');
textcolor(magenta);
writeln(' *(___ (__( |_, (___ (__(_ |_, (__( (__| (__) | (__(*');
textcolor(magenta);
writeln(' * *');
textcolor(yellow);
writeln(' *******************************************************');
writeln(' ');
textcolor(lightred);
writeln(' NOTA: Si desea calcular el seno, coseno, tangente, raiz cuadrada o ');
writeln(' potencia al cuadrado solo inserte el primer digito.');
writeln(' ');
textcolor(white);
write('Cuantos digitos va a ingresar 1 o 2 : '); read(Ding);
writeln;
if Ding = 2 then
begin
write('Introduzca el primer digito: ');read(a);
writeln;
write('Introduzca el segundo digito: ');read(b);
writeln;
2. writeln('Indique la operacion ha realizar:');
writeln('1=Suma');
writeln('2=Resta');
writeln('3=Multiplicacion');
writeln('4=Division');
op:= readkey;
end;
if Ding = 1 then
begin
write('Introduzca el primer digito: ');read(a);
writeln;
writeln('Indique la operacion ha realizar:');
writeln('5=Seno');
writeln('6=Coseno');
writeln('7=Tangente');
writeln('8=Raiz cuadrada');
writeln('9=Potencia al cuadrado');
op:= readkey;
end;
case op of
'1': r:=a+b;
'2': r:=a-b;
'3': r:=a*b;
'4': r:=a/b;
'5': r:=sin(a);
'6': r:=cos(a);
'8': r:=sqrt(a);
'9': r:=sqr(a);
end;
textcolor(lightgreen);
writeln(' El resultado es: ',r :2:2);
writeln;
repeat
textcolor(white);
write(' Desea empezar de nuevo s/n: ');
res:= readkey ;
until (res='s') or (res='n');
3. clrscr;
until res = 'n';
textcolor(lightgreen);
gotoXY(20,11);write('** Presione una tecla para finalizar **');
readkey;
end.