Vykreslí sin, cos, tangens a kotangens na súradnicovú os

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Kategórie: KMP (Programy mladých programátorů)
sin-cos.pngAutor: Ján Benkovič
web: www.tbteacher.host.sk

Program: Sin-cos.pas
Soubor exe: Sin-cos.exe

Vykreslí sin, cos, tangens a kotangens na súradnicovú os.
{ SIN-COS.PAS                            Copyright (c) Jan Benkovic }
{ Vykresli sin, cos, tangens a kotangens na suradnicovu os.         }
{                                                                   }
{ Datum:11.05.2000                             http://www.trsek.com }
 
uses graph,crt;
var
 a,gd,gm : integer;
 c:char;
 
procedure vycisti;
 begin
  cleardevice;
  setcolor(white);
  line(150,1,150,480);
  line(0,240,640,240);
  outtextxy(140,245,'0');
  outtextxy(630,245,'X');
  outtextxy(138,1,'Y');
  line(228 ,240, 228,235);
  outtextxy(218,250,'2/PI');
  line(307 ,240, 307,235);
  outtextxy(302,250,'PI');
  line(385 ,240, 385,235);
  outtextxy(365,250,'2*PI/3');
  line(465 ,240, 465,235);
  outtextxy(452,250,'2*PI');
  setcolor(red);
  outtextxy(1,1,'Sinus');
  setcolor(blue);
  outtextxy(1,11,'Cosinus');
  setcolor(green);
  outtextxy(1,21,'Sinus+Cosinus');
  setcolor(3);
  outtextxy(1,31,'Tangens');
  setcolor(5);
  outtextxy(1,41,'CoTangens');
 end;
 
begin
 detectgraph(gd,gm);
 initgraph(gd,gm,'');
 vycisti;
 moveto(150,240);
 for a:= 1 to 360 do
  begin
   delay(2);
   setcolor(red);
   lineto(a+150,-round(sin(0.02*a)*90)+240);
  end;
 c:=readkey;
 vycisti;
 moveto(150,150);
 for a:= 1 to 360 do
  begin
   delay(2);
   setcolor(blue);
   lineto(a+149,-round(cos(0.02*a)*90)+240);
  end;
 c:=readkey;
 vycisti;
 moveto(150,150);
 for a:= 1 to 360 do
  begin
   setcolor(green);
   delay(2);
   lineto(a+149,-round((cos(0.02*a)*90)+(sin(0.02*a)*90))+240);
  end;
 c:=readkey;
 vycisti;
 moveto(150,240);
 for a:= 1 to 360 do
  begin
   setcolor(3);
   delay(2);
   lineto(a+150,-round((sin(0.02*a)*90)/(cos(0.02*a)))+240);
  end;
 c:=readkey;
 vycisti;
 moveto(150,0);
 for a:= 1 to 360 do
  begin
   setcolor(5);
   delay(2);
   lineto(a+150,-round((cos(0.02*a)*90/(sin(0.02*a))))+240);
  end;
 c:=readkey;
end.