Uses Graph; Const amount = 10; (* Draws the gistogram of the given sequence on the screen *) Procedure DrawGistogram(place: Integer; arr: Array of Integer; Color: Integer); Var i, size_x, Top: Integer; left, right: integer; start, range: Record x, y: Integer; End; s: string; numGeneral: integer; Begin Start.X := 1; Start.Y := GetMaxY; SetColor(White); SetBkColor(Black); Range.X := GetMaxX div 2; Range.Y := GetMaxY div 2; numGeneral := 0; for i := 0 to pred(amount) do inc(numGeneral, arr[i]); Line(Start.X, Start.Y, Start.X, Start.Y); size_x := Range.X div amount; SetFillStyle(SolidFill, Color); For i := 0 To Pred(amount) Do Begin left := Start.X + i * size_x; right := left + size_x; top := Start.Y - Trunc( Range.Y * arr[i] / NumGeneral ); bar3d(left + 1, top + 1, right - 1, Start.Y - 1, 15, true); str(arr[i], s); outtextxy( left, Start.Y + 3, s ); End; End; const data: array[1 .. amount] of integer = (10, 12, 15, 20, 32, 55, 40, 32, 56, 12); var grDriver: Integer; grMode: Integer; ErrCode: Integer; begin grDriver := Detect; InitGraph(grDriver, grMode,''); ErrCode := GraphResult; if ErrCode <> grOk then begin writeln('error: ', grapherrormsg(errcode)); readln; halt(100) end; DrawGistogram(0, data, Red); readln; closegraph; end.