| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- Uses Mytpu,CRT,Graph;
- Const
- MaxValues = 6;
- Type ValType = record
- n : integer;
- p : real;
- end;
- Var
- values : array [1..MaxValues] of ValType;
- SumVal : Word;
- I : byte;
- LastArc : Word;
- Coords : ArcCoordsType;
- {--------====================--------------}
- Procedure Iniit;
- Var
- i:byte;
- Begin
- InitVGA;
- SumVal := 0;
- for i:=1 to MaxValues do
- begin
- values[i].n:=GetValue('Вводите значения',GetMaxX div 2,GetMaxY div 2,1,32767);
- SumVal := SumVal + values[i].n;
- end;
- for i := 1 to MaxValues do values[i].p :=values[i].n/SumVal;
- End;{Iniit}
- {---------------------------}
- Procedure Show3dSlice(StAng,EAng:integer;Show:boolean);
- var t:byte;
- Begin
- Arc(300,200,stang,eang,100);
- PieSlice(300,200,stang,eang,100);
- SetColor(white);
- GetArcCoords(Coords);
- With coords do
- begin
- SetColor(White);
- Line(300,200,xstart,ystart);
- Line(300,200,xend,yend);
- if stang > 180 then Line(xstart,Ystart,Xstart,Ystart+30);
- if eang > 180 then Line(xend,Yend,Xend,Yend+30);
- if eang > 180 then
- if stang > 180 then
- for t := 1 to 30 do
- begin
- if (t = 1) or (t=30) then Setcolor(white) else SetColor(i);
- Arc(300,199+t,stang,eang,100)
- end
- else
- for t := 1 to 30 do
- begin
- if (t = 1) or (t=30) then Setcolor(white) else SetColor(i);
- Arc(300,199+t,180,eang,100);
- end;
- end;
- End;
- {---------------------------}
- Begin
- Iniit;
- SetAspectRatio(3,5);
- For i := 1 to MaxValues do
- begin
- SetColor(i);
- SetFillStyle(solidfill,i);
- Show3dslice(LastArc,round(LastArc+360*values[i].p),false);
- LastArc:=round(LastArc+360*values[i].p);
- end;
- Line(200,200,200,230);
- ReadKey;
- CloseVGA
- End.
|