Program simuluje kalkulacku.

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Kategórie: KMP (Programy mladých programátorů)

Autor: Patrik Hlinka
Program: Kalk.pas
Soubor exe: Kalk.exe

Program simuluje kalkulacku.
{ KALK.PAS                              Copyright (c) Patrik Hlinka }
{ Program simuluje kalkulacku.                                      }
{                                                                   }
{             v1.2}   {//v1.0 ... povodna verzia//}
{   Autor:        }   {///////////////////////////}
{     Patrik      }   {//v1.1 ... uprava vzhladu//}
{       HLINKA    }   {///////////////////////////}
{              '07}   {//v1.2 ... konecne upravy//}
{ Datum:10.01.2007                             http://www.trsek.com }
 
Program Kalkulacka;
 uses crt;
 var a,b,N: integer;
 
 Procedure Scitovanie;
  begin
   writeln ('Zadaj 2 cisla, s ktorymi chces pracovat:');
   readln (a);
   readln (b);
   clrscr;
    writeln;
    textcolor (blue);
    textbackground (white);
    gotoXY (21,4);
    writeln ('            T E X T O V A            ');
    gotoXY (21,6);
    writeln ('      K A L K U L A C K A  v1.2      ');
    textcolor (white);
    textbackground (black);
   write (a);
   write ('+');
   writeln (b);
   writeln ('__________');
   writeln (a+b);
   readln;
  end;
 
 Procedure Odcitovanie;
  begin
   writeln ('Zadaj 2 cisla, s ktorymi chces pracovat:');
   readln (a);
   readln (b);
   clrscr;
    writeln;
    textcolor (blue);
    textbackground (white);
    gotoXY (21,4);
    writeln ('            T E X T O V A            ');
    gotoXY (21,6);
    writeln ('      K A L K U L A C K A  v1.2      ');
    textcolor (white);
    textbackground (black);
   write (a);
   write ('-');
   writeln (b);
   writeln ('__________');
   writeln (a-b);
   readln;
  end;
 
 Procedure Nasobenie;
  begin
   writeln ('Zadaj 2 cisla, s ktorymi chces pracovat:');
   readln (a);
   readln (b);
   clrscr;
    writeln;
    textcolor (blue);
    textbackground (white);
    gotoXY (21,4);
    writeln ('            T E X T O V A            ');
    gotoXY (21,6);
    writeln ('      K A L K U L A C K A  v1.2      ');
    textcolor (white);
    textbackground (black);
   write (a);
   write ('*');
   writeln (b);
   writeln ('__________');
   writeln (a*b);
   readln;
  end;
 
 Procedure Delenie;
  begin
   writeln ('Zadaj 2 cisla, s ktorymi chces pracovat:');
   readln (a);
   readln (b);
   clrscr;
    writeln;
    textcolor (blue);
    textbackground (white);
    gotoXY (21,4);
    writeln ('            T E X T O V A            ');
    gotoXY (21,6);
    writeln ('      K A L K U L A C K A  v1.2      ');
    textcolor (white);
    textbackground (black);
   write (a);
   write ('/');
   writeln (b);
   writeln ('__________');
   writeln (a/b);
   readln;
  end;
 
 Procedure Menu;
  begin
   ClrScr;
   textcolor (blue);
   textbackground (white);
   gotoXY (21,4);
   writeln ('            T E X T O V A            ');
   gotoXY (21,6);
   writeln ('      K A L K U L A C K A  v1.2      ');
   textcolor (white);
   textbackground (black);
  end;
 
begin
 ClrScr;
  textcolor (blue);
  textbackground (white);
  gotoXY (21,4);
  writeln ('            T E X T O V A            ');
  gotoXY (21,6);
  writeln ('       K A L K U L A C K A  v1.2     ');
  textcolor (white);
  textbackground (black);
 gotoXY (26,14);
 writeln (' press ENTER to continue...');
 gotoXY (1,15);
 readln;
   ClrScr;
   textcolor (blue);
   textbackground (white);
   gotoXY (21,4);
   writeln ('            T E X T O V A            ');
   gotoXY (21,6);
   writeln ('       K A L K U L A C K A  v1.2     ');
   textcolor (white);
   textbackground (black);
 gotoXY (1,8);
 writeln ('Pokracovat..........press "0-9"');
 writeln ('Ukoncit program.....press "EXIT"');
 writeln;
 readln (N);
    if N=1 then begin Menu end;
   ClrScr;
   textcolor (blue);
   textbackground (white);
   gotoXY (21,4);
   writeln ('            T E X T O V A            ');
   gotoXY (21,6);
   writeln ('       K A L K U L A C K A  v1.2     ');
   textcolor (white);
   textbackground (black);
 writeln;
 writeln ('Vyber operaciu, ktoru chces vykonat:');
 writeln ('1.+   2.-   3.*   4./');
 writeln;
 readln (N);
 
 if N<>0 then begin Menu end;
  writeln;
 
    if N=1 then begin Scitovanie;
     end;
    if N=2 then begin Odcitovanie;
     end;
    if N=3 then begin Nasobenie;
     end;
    if N=4 then begin Delenie;
     end;
 ClrScr;
end.