Program wykresy;
uses crt,graph;
type tab=array[1..10] of integer;
var t:tab;
    karta,tryb,i,x,max,y,dx,kk,kp,sum,p:integer;
    dy:real;
BEGIN
Randomize;
For i:=1 to 10 do t[i]:=Random(90)+10;
DetectGraph(karta,tryb);
InitGraph(karta,tryb,'');

{ Wykres Slupkowy }

p:=20;
y:=GetMaxY-p;
max:=0;
dx:=(GetMaxX-20) div 10;
For i:=1 to 10 do
   If max<t[i] then max:=t[i];
dy:=y/max;
For i:=1 to 10 do
  Begin
   SetFillStyle(1,i);
   x:=t[i];
   Bar3d((i-1)*dx+p,y-(Round(dy*x)-25),i*dx,y,10,true);
  End;

ReadKey;
ClearDevice;

{ Wykres kolowy }

sum:=0;
For i:=1 to 10 do sum:=sum+t[i];
kp:=0;
kk:=0;
For i:=1 to 10 do
   Begin
    SetFillStyle(1,i);
    kp:=kk;
    kk:=kk+Round(t[i]/sum*360);
    If i=10 then kk:=360;
PieSlice(GetMaxX div 2,GetMaxY div 2,kp,kk,(GetMaxY div 2)-20);
   End;
ReadKey;

CloseGraph;
End.