Calculadora desarrollada por Dinamo_lmjs

{ PROGRAMMED BY DINAMO }
{ CODING BEGINNED - SUNDAY 9 OF OCTOBER 2005, 12:35 HRS. }
{ http://mx.geocities.com/manuel_bach16/lenguajes/}
 
{É������������������������������»}
{º    Universidad  de Colima    º}
{º    Facultad de Telematica    º}
{Ì������������������������������¹}
{º    Lenguajes Algoritmicos    º}
{º                              º}
{º       AUTOR: ¸DINAMO         º}
{º    [Luis Manuel Juarez S.]   º}
{º   [dinamo_lmjs@hotmail.com]  º}
{È������������������������������¼}
 
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
Uses
    Crt,Dos;
Var
   sel,aux:Char;                 {Variables tipo caracter}
   dis:String[9];                {Display de la calculadora}
   lim,i,j,time,flag_fun:Byte;
   point,zero,kn,clean:Boolean;  {Variables Booleanas para evitar erres.}
   n1,n2,auxn1,auxn2,r:Real;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
   Procedure calculator;
    Var
      x,y:Byte;
    Begin
      Textcolor(15); Textbackground(1);  {Colorear el fondo y los numeros de la calculadora}
      x:=25; y:=5;
      Gotoxy(x, y  ); Write(' É���������������������������������» ');  {|}
      Gotoxy(x,y+ 1); Write(' ºÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿º ');  {||}
      Gotoxy(x,y+ 2); Write(' º³                               ³º ');  {|||}
      Gotoxy(x,y+ 3); Write(' ºÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙº ');  {||||}
      Gotoxy(x,y+ 4); Write(' Ì�������������������������Ë�������¹ ');  {|||||}
      Gotoxy(x,y+ 5); Write(' º ÚÄÄÄ¿ ÚÄÄÄ¿ ÚÄÄÄ¿ ÚÄÄÄ¿ º ÚÄÄÄ¿ º ');  {||||||}
      Gotoxy(x,y+ 6); Write(' º ³ 7 ³ ³ 8 ³ ³ 9 ³ ³ / ³ º ³ C ³ º ');  {|||||||}
      Gotoxy(x,y+ 7); Write(' º ÀÄÄÄÙ ÀÄÄÄÙ ÀÄÄÄÙ ÀÄÄÄÙ º ÀÄÄÄÙ º ');  {||||||||}
      Gotoxy(x,y+ 8); Write(' º ÚÄÄÄ¿ ÚÄÄÄ¿ ÚÄÄÄ¿ ÚÄÄÄ¿ º ÚÄÄÄ¿ º ');  {||||||||| Dibujar una calculadora estatica}
      Gotoxy(x,y+ 9); Write(' º ³ 4 ³ ³ 5 ³ ³ 6 ³ ³ * ³ º ³ D ³ º ');  {||||||||| en la pantalla}
      Gotoxy(x,y+10); Write(' º ÀÄÄÄÙ ÀÄÄÄÙ ÀÄÄÄÙ ÀÄÄÄÙ º ÀÄÄÄÙ º ');  {||||||||}
      Gotoxy(x,y+11); Write(' º ÚÄÄÄ¿ ÚÄÄÄ¿ ÚÄÄÄ¿ ÚÄÄÄ¿ º ÚÄÄÄ¿ º ');  {|||||||}
      Gotoxy(x,y+12); Write(' º ³ 1 ³ ³ 2 ³ ³ 3 ³ ³ - ³ º ³ û ³ º ');  {||||||}
      Gotoxy(x,y+13); Write(' º ÀÄÄÄÙ ÀÄÄÄÙ ÀÄÄÄÙ ÀÄÄÄÙ º ÀÄÄÄÙ º ');  {|||||}
      Gotoxy(x,y+14); Write(' º ÚÄÄÄ¿ ÚÄÄÄ¿ ÚÄÄÄ¿ ÚÄÄÄ¿ º ÚÄÄÄ¿ º ');  {||||}
      Gotoxy(x,y+15); Write(' º ³ . ³ ³ 0 ³ ³ = ³ ³ + ³ º ³ ý ³ º ');  {|||}
      Gotoxy(x,y+16); Write(' º ÀÄÄÄÙ ÀÄÄÄÙ ÀÄÄÄÙ ÀÄÄÄÙ º ÀÄÄÄÙ º ');  {||}
      Gotoxy(x,y+17); Write(' È�������������������������Ê�������¼ ');  {|}
    End;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
   Procedure teclas;
    Var
      wait:Byte;
    Begin
     Textcolor(3); wait:=40;
     Case sel of
       {Botones Fila Uno}
       #55: Begin Gotoxy(30,11); Write('7'); Delay(wait); Textcolor(15); Gotoxy(30,11); Write('7');  End; {|}
       #56: Begin Gotoxy(36,11); Write('8'); Delay(wait); Textcolor(15); Gotoxy(36,11); Write('8');  End; {|| Efecto}
       #57: Begin Gotoxy(42,11); Write('9'); Delay(wait); Textcolor(15); Gotoxy(42,11); Write('9');  End; {|| de Presion}
       #47: Begin Gotoxy(48,11); Write('/'); Delay(wait); Textcolor(15); Gotoxy(48,11); Write('/');  End; {|| de Teclas}
       #67: Begin Gotoxy(56,11); Write('C'); Delay(wait); Textcolor(15); Gotoxy(56,11); Write('C');  End; {|| 7 a C}
       {Botones Fila Uno}
 
       {Botones Fila Dos}
       #52: Begin Gotoxy(30,14); Write('4'); Delay(wait); Textcolor(15); Gotoxy(30,14); Write('4');  End; {|}
       #53: Begin Gotoxy(36,14); Write('5'); Delay(wait); Textcolor(15); Gotoxy(36,14); Write('5');  End; {|| Efecto}
       #54: Begin Gotoxy(42,14); Write('6'); Delay(wait); Textcolor(15); Gotoxy(42,14); Write('6');  End; {|| de Presion}
       #42: Begin Gotoxy(48,14); Write('*'); Delay(wait); Textcolor(15); Gotoxy(48,14); Write('*');  End; {|| de Teclas}
       #08: Begin Gotoxy(56,14); Write('D'); Delay(wait); Textcolor(15); Gotoxy(56,14); Write('D');  End; {|| 4 a D}
       {Botones Fila Dos}
 
       {Botones Fila Tres}
       #49: Begin Gotoxy(30,17); Write('1'); Delay(wait); Textcolor(15); Gotoxy(30,17); Write('1');  End; {|}
       #50: Begin Gotoxy(36,17); Write('2'); Delay(wait); Textcolor(15); Gotoxy(36,17); Write('2');  End; {|| Efecto}
       #51: Begin Gotoxy(42,17); Write('3'); Delay(wait); Textcolor(15); Gotoxy(42,17); Write('3');  End; {|| de Presion}
       #45: Begin Gotoxy(48,17); Write('-'); Delay(wait); Textcolor(15); Gotoxy(48,17); Write('-');  End; {|| de Teclas}
       #83: Begin Gotoxy(56,17); Write('û'); Delay(wait); Textcolor(15); Gotoxy(56,17); Write('û');  End; {|| 1 a û}
       {Botones Fila Tres}
 
       {Botones Fila Cuatro}
       #46: Begin Gotoxy(30,20); Write('.'); Delay(wait); Textcolor(15); Gotoxy(30,20); Write('.');  End; {|}
       #48: Begin Gotoxy(36,20); Write('0'); Delay(wait); Textcolor(15); Gotoxy(36,20); Write('0');  End; {|| Efecto}
       #13: Begin Gotoxy(42,20); Write('='); Delay(wait); Textcolor(15); Gotoxy(42,20); Write('=');  End; {|| de Presion}
       #43: Begin Gotoxy(48,20); Write('+'); Delay(wait); Textcolor(15); Gotoxy(48,20); Write('+');  End; {|| de Teclas}
       #32: Begin Gotoxy(56,20); Write('ý'); Delay(wait); Textcolor(15); Gotoxy(56,20); Write('ý');  End; {|| . a ý}
       {Botones Fila Cuatro}
     End;
    End;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
   Procedure limpiar;         {Procedimiento para limpiar Display}
    Begin
       For i:=lim to 9 do
          dis[i]:=' ';
       Textcolor(1); Gotoxy(38,7); Write('ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ');
       lim:=9;
       point:=True;           {Activar la colocacion del punto decimal}
       zero:=False;           {Activar la alerta del Cero}
       clean:=False;          {Avtivar el limpiado del Display}
    End;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
   Procedure add;       {Agregar caracteres}
    Begin
      If clean Then             {Si clean es True, limpiar Display}
        limpiar;
      If lim>0 Then             {Si limite es mayor a 0, hacer}
       Begin
         If lim=9 Then          {Condicion precaucion Cero}
          zero:=False;
         For j:=lim to 9 do
           Begin
             aux:=dis[j];       {|}
             dis[j-1]:=aux;     {|| Codigo encargado de agregar los caracteres al Display}
             dis[j]:=sel;       {|}
           End;
        lim:=lim-1;             {Decrementar el limite de la cadena}
       End
      Else
       Begin                  {Activar mensaje de Error}
          Textbackground(0);
          Textcolor(4); Gotoxy(32,24); Write(char(7),'Haz llegado al Limite'); Delay(time);
          Textcolor(0); Gotoxy(32,24); Write('Haz llegado al Limite');
       End;
    End;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
   Procedure cero;
    Begin
     If clean Then              {Si clean es True, Limpiar Display}
       limpiar;
     If lim>0 Then              {Si limite es mayor a 0, hacer}
      Begin
       If lim=9 Then            {Codigo Precaucion CEro}
        zero:=True;
       If (lim=8) And zero Then
        Begin                     {Mensaje de Alerta de Ceros}
          Textbackground(0);
          Textcolor(4); Gotoxy(26,24); Write(char(7),'Colocar un caracter diferente de 0'); Delay(time);
          Textcolor(0); Gotoxy(26,25); Write('Colocar un caracter diferente de 0');
        End
       Else                 {Si no hay problemas con el cero, hacer}
        Begin
         For j:=lim to 9 do
           Begin
             aux:=dis[j];    {|}
             dis[j-1]:=aux;  {|| Codigo encargado de agregar los caracteres al Display}
             dis[j]:=sel;    {|}
           End;
         lim:=lim-1;     {Decrementar el limite de la cadena}
        End;
      End
     Else
      Begin                       {Activar mensaje de Error}
          Textbackground(0);
          Textcolor(4); Gotoxy(32,24); Write(char(7),'Haz llegado al Limite'); Delay(time);
          Textcolor(0); Gotoxy(32,24); Write('Haz llegado al Limite');
      End;
    End;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
   Procedure punto;         {Procedimiento para controlar los puntos decimales}
    Begin
     If clean Then          {Si clean es True, limpiar display}
       limpiar;
     If lim>0 Then          {Si limite es mayor a 0, hacer}
      Begin
       If point Then        {Si point(punto) es True, hacer}
         Begin
           If lim=9 Then    {Si limite es 9, entonces agregar un 0 y punto [0.] en el Display}
             Begin
               dis[9]:='0'; {| Codigo encargado de realizar}
               lim:=lim-1;  {| lo antes mensionado}
             End;
           For j:=lim to 9 do
             Begin
               aux:=dis[j];    {|}
               dis[j-1]:=aux;  {| Codigo encargado de agregar los caracteres al Dislpay}
               dis[j]:=sel;    {|}
             End;
           lim:=lim-1;       {Decrementar el limite de la cadena}
           point:=False;     {Activar point, para decir que ya tenemos un punto}
         End
       Else                {Si ya existe un punto, hacer}
        Begin                {Activar codigo de error}
          Textbackground(0);
          Textcolor(4); Gotoxy(28,24);  Write(char(7),'Solo puedes colocar un punto'); Delay(time);
          Textcolor(0); Gotoxy(28,24);  Write('Solo puedes colocar un punto');
        End;
      End
     Else                {Si el limite de la cadena es 0, hacer}
      Begin               {Activar codigo de error}
       Textbackground(0);
       Textcolor(4); Gotoxy(32,24);  Write(char(7),'Haz llegado al Limite'); Delay(time);
       Textcolor(0); Gotoxy(32,24);  Write('Haz llegado al Limite');
      End;
    End;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
   Procedure del;           {Procedimiento para eliminar un caracter del Display}
    Var
      auxlim:Byte;          {Variable auxliar del limite de la cadena}
    Begin
     If lim<9 Then          {Si limite es menor a 9, hacer}
      Begin
       If lim=0 Then        {Si limite es igual a 0, hacer}
        auxlim:=1           {Asignar a auxlim el valor de 1}
       Else                 {Si limite no es igual a 0, hacer}
        auxlim:=0;          {Asiganr a auxlim el valor de 0}
       For j:=9 downto lim+auxlim do
         dis[j]:=dis[j-1];      {Ciclo para el borrado de un caracter}
       For j:=9 downto lim do
        Begin
          If dis[j]=#46 Then     {Si existe un punto}
             Begin point:=False;  Break; End  {No activar la bandera point}
          Else                   {Si no existe el punto}
              point:=True;         {Activar la bandera point}
        End;
       lim:=lim+1;               {Incrementar el limite de la cadena, ya que borramos un caracter}
      End
     Else               {Si limite es igual a 9, hacer}
      Begin              {Activar codigo de alerta}
       Textbackground(0);
       Textcolor(4); Gotoxy(35,24); Write(char(7),'No hay caracteres'); Delay(time);
       Textcolor(0); Gotoxy(35,24); Write('No hay caracteres');
      End;
    End;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
   Procedure convert;              {Procedimiento para convertir la cadena a numero}
    Var
     ce,cd,c,limnew,aux,lol:Byte; {|| Variables auxiliares}
     inc:Longint;                 {|| utilizadas para la conversion}
     divo:Real;                   {|| de la cadena a numeros}
    Begin
     limnew:=lim+1;               {Variable limite nuevo asignarle el limite de la cadena mas 1}
     auxn1:=0; auxn2:=0;          {inicializar las variables para la convertios de enteros y decimales}
     For c:=9 downto lim do
      Begin
       If dis[c]=#46 Then         {Si existe el punto decimal, hacer}
        Begin
          cd:=9-c;                {|}
          ce:=9-(limnew+cd);      {||}
          lol:=1;                 {|| saber cuantos enteros y decimales hay}
          break;                  {|}
        End
       Else                       {Si no existe el punto decimal}
        If c=lim Then
         Begin
           ce:=9-lim;             {|}
           cd:=0;                 {| Hacer el conteo de los enteros }
           lol:=0;                {|}
         End;
      End;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
     {Obtener Enteros}
     inc:=1;
     For c:=9-(cd+lol) downto lim do  {Enteros}
      Begin
        Case dis[c] of
         '0': Begin aux:=0; auxn1:=auxn1+(aux*inc)  end; {|}
         '1': Begin aux:=1; auxn1:=auxn1+(aux*inc)  end; {||}
         '2': Begin aux:=2; auxn1:=auxn1+(aux*inc)  end; {|||}
         '3': Begin aux:=3; auxn1:=auxn1+(aux*inc)  end; {||||}
         '4': Begin aux:=4; auxn1:=auxn1+(aux*inc)  end; {||||| Conocer el valor numerico}
         '5': Begin aux:=5; auxn1:=auxn1+(aux*inc)  end; {||||| de los enteros}
         '6': Begin aux:=6; auxn1:=auxn1+(aux*inc)  end; {||||}
         '7': Begin aux:=7; auxn1:=auxn1+(aux*inc)  end; {|||}
         '8': Begin aux:=8; auxn1:=auxn1+(aux*inc)  end; {||}
         '9': Begin aux:=9; auxn1:=auxn1+(aux*inc)  end; {|}
        End;
        inc:=inc*10;
      End;
     {Obtener Enteros}
 
     {Obtener Decimales}
     inc:=10;
     For c:=9-(cd-1) to 9 do  {Enteros}
      Begin
        divo:=1/inc;
        Case dis[c] of
         '0': Begin aux:=0; auxn2:=auxn2+(aux*divo) end; {|}
         '1': Begin aux:=1; auxn2:=auxn2+(aux*divo) end; {||}
         '2': Begin aux:=2; auxn2:=auxn2+(aux*divo) end; {|||}
         '3': Begin aux:=3; auxn2:=auxn2+(aux*divo) end; {||||}
         '4': Begin aux:=4; auxn2:=auxn2+(aux*divo) end; {||||| Conocer el valor numerico}
         '5': Begin aux:=5; auxn2:=auxn2+(aux*divo) end; {||||| de los decimales}
         '6': Begin aux:=6; auxn2:=auxn2+(aux*divo) end; {||||}
         '7': Begin aux:=7; auxn2:=auxn2+(aux*divo) end; {|||}
         '8': Begin aux:=8; auxn2:=auxn2+(aux*divo) end; {||}
         '9': Begin aux:=9; auxn2:=auxn2+(aux*divo) end; {|}
        End;
        inc:=inc*10;
      End;
     {Obtener Decimales}
    End;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
   Procedure funciones;  {Procedimiento de las funciones Aritmecas}
    Var
      pivofun:Byte;
    Begin
      Case sel of
          #43: Begin      {Si el simbolo es [+], hacer}
                 If lim<9 Then
                  Begin
                   convert;
                   If kn Then
                     Begin n1:=auxn1+auxn2; kn:=False; clean:=True; End
                   Else
                     Begin n2:=auxn1+auxn2; End;
                   If n2<>0 Then
                    Begin
                     limpiar; r:=n1+n2;
                     n1:=r;
                     n2:=0;
                    End;
                  End;
               End;
          #45: Begin     {Si el simbolo es [-], hacer}
                 If lim<9 Then
                  Begin
                   convert;
                   If kn Then
                     Begin n1:=auxn1+auxn2; kn:=False; clean:=True; End
                   Else
                     Begin n2:=auxn1+auxn2; End;
                   If n2<>0 Then
                    Begin
                     limpiar; r:=n1+n2;
                     n1:=r;
                     n2:=0;
                    End;
                  End;
               End;
          #47: Begin    {Si el simbolo es [/], hacer}
                 If lim<9 Then
                  Begin
                   convert;
                   If kn Then
                     Begin n1:=auxn1+auxn2; kn:=False; clean:=True; End
                   Else
                     Begin n2:=auxn1+auxn2; End;
                   If n2<>0 Then
                    Begin
                     limpiar; r:=n1/n2;
                     n1:=r;
                     n2:=0;
                    End;
                  End;
               End;
          #42: Begin    {Si el simbolo es [*], hacer}
                 If lim<9 Then
                  Begin
                   convert;
                   If kn Then
                     Begin n1:=auxn1+auxn2; kn:=False; clean:=True; End
                   Else
                     Begin n2:=auxn1+auxn2; End;
                   If n2<>0 Then
                    Begin
                     limpiar; r:=n1*n2;
                     n1:=r;
                     n2:=0;
                    End;
                  End;
               End;
          #32: Begin   {Si el simbolo es [ESPACIO], hacer}
                 If lim<9 Then
                   Begin
                     convert;
                     limpiar;
                     n1:=auxn1+auxn2; kn:=False; clean:=True;
                     r:=sqr(n1);
                     n1:=r;
                     n2:=0;
                   End
                 Else
                   Begin
                     limpiar;
                     r:=sqr(n1);
                     n1:=r;
                   End;
               End;
          #83: Begin   {Si el simbolo es [S], hacer}
                 If lim<9 Then
                   Begin
                     convert;
                     limpiar;
                     n1:=auxn1+auxn2; kn:=False; clean:=True;
                     r:=sqrt(n1);
                     n1:=r;
                   End
                 Else
                   Begin
                     limpiar;
                     r:=sqrt(n1);
                     n1:=r;
                   End;
               End;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
          #13: Begin   {Si el simbolo es [=], hacer}
                If lim<9 Then
                 Begin
                   Case flag_fun of  {Conocer que funcion quedo pendiente}
                     1: Begin         {Suma}
                         convert;
                         If kn Then
                           Begin n1:=auxn1+auxn2; kn:=False; clean:=True; End
                         Else
                           Begin n2:=auxn1+auxn2; End;
                         If n2<>0 Then
                           Begin
                             limpiar; r:=n1+n2;
                             n1:=r;
                             n2:=0;
                           End;
                        End;
                     2: Begin        {Resta}
                         convert;
                         If kn Then
                           Begin n1:=auxn1+auxn2; kn:=False; clean:=True; End
                         Else
                           Begin n2:=auxn1+auxn2; End;
                         If n2<>0 Then
                           Begin
                             limpiar; r:=n1-n2;
                             n1:=r;
                             n2:=0;
                           End;
                        End;
                     3: Begin       {Division}
                         convert;
                         If kn Then
                           Begin n1:=auxn1+auxn2; kn:=False; clean:=True; End
                         Else
                           Begin n2:=auxn1+auxn2; End;
                         If n2<>0 Then
                           Begin
                             limpiar; r:=n1/n2;
                             n1:=r;
                             n2:=0;
                           End;
                        End;
                     4: Begin     {Multiplicacion}
                         convert;
                         If kn Then
                           Begin n1:=auxn1+auxn2; kn:=False; clean:=True; End
                         Else
                           Begin n2:=auxn1+auxn2; End;
                         If n2<>0 Then
                           Begin
                             limpiar; r:=n1*n2;
                             n1:=r;
                             n2:=0;
                           End;
                        End;
                   End;
                  If flag_fun<>0 Then  {Si la bandera de las funciones es diferente a 0, hacer}
                   Begin            {Mostrar en el Display el valor procesado}
                     Textcolor(15); Textbackground(1);
                     Gotoxy(48,7); Write(r:0:4);
                   End;
                 End;
               End;
      End;
 
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
 
     If r<>0 Then  {Si r es diferente de 0, hacer}
      Begin        {Mostrar en el Display el valor Procedado}
       Textcolor(15); Textbackground(1);
       Gotoxy(48,7); Write(r:0:4);
       clean:=True;  {Activar el limpiado de pantalla}
      End;
    End;
 
   Procedure bye;
    Var
     bye:Integer;
    Begin
     gotoxy(1,1); Randomize;
     repeat
       Gotoxy(1,1); Textcolor(random(15)+1);
       For bye:=1 to 80*46 do
        Begin
         write('Û');
        End;
       For bye:=1 to 4 do Write(' GGR I Like u a Lot ');
       For bye:=1 to 4 do Write('ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ');
       For bye:=1 to 4 do Write(' GGR I Like u a Lot ');
       For bye:=1 to 4 do Write('ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ');
       For bye:=1 to 4 do Write(' GGR I Like u a Lot ');
       For bye:=1 to 80*50 do
         Begin
          write(' ');
         End;
       Delay(random(200)+5);
     Until Keypressed;
     Gotoxy(35,25); Write('Fucking End...'); Delay(150);
 end;
 
Begin
{   Textmode(C80);}                 {Activar la pantalla Con 80 Columnas}
   Textbackground(0); Clrscr;       {Limpiar pantalla y colocar fondo negro}
   point:=True; zero:=False; kn:=True; clean:=False; {Inicializar todos las banderas a utilizar}
   lim:=9; time:=250;  n1:=0; n2:=0; flag_fun:=0;    {Inicializar variables y banderas enteras a utilizar}
   calculator;                                       {Dibujar la interfaz de la calculadora}
{ THIS PROGRAM WAS DOWNLOADED FOR MX.GEOCITIES.COM/MANUEL_BACH16/LENGUAJES }
{ THIS PROGRAM WAS CODED WITH TEACHING PURPOSES }
   While sel<>#27 do                                 {Ciclo general del Programa}
    Begin
      sel:=Upcase(Readkey);                            {Leer un caracter de la consola}
      Textbackground(1);                               {Colorear el fondo de azul}
      teclas;                                          {Generar el efecto de las teclas}
      Textcolor(15);                                   {Colocar el color del texto}
      Case sel of                                      {Evaluar los posibles casos}
        #49..#57: add;                                 {Si es de 1 a 9 hacer}
             #48: cero;                                {Si es 0 hacer}
             #46: punto;                               {Si es un punto evaluar}
             #08: del;                                 {Borrar un numero no deseado}
             #43: Begin flag_fun:=1; funciones; End;   {En caso de suma}
             #45: Begin flag_fun:=2; funciones; End;   {En caso de resta}
             #47: Begin flag_fun:=3; funciones; End;   {En caso de division}
             #42: Begin flag_fun:=4; funciones; End;   {En caso de multiplicacion}
             #32: Begin flag_fun:=5; funciones; End;   {En caso de elevar al cuadrado}
             #83: Begin flag_fun:=6; funciones; End;