Подскажите пожалуйста!!!!

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by Nogir15, 18 Apr 2011.

  1. Nogir15

    Nogir15 New Member

    Joined:
    28 Nov 2010
    Messages:
    11
    Likes Received:
    0
    Reputations:
    -1
    http://i399.odnoklassniki.ru/getImage?photoId=299218307472&photoType=0 подскажитк что я неправильно сделал резельтат уходит в минусы!!!!!!!
     
  2. Nogir15

    Nogir15 New Member

    Joined:
    28 Nov 2010
    Messages:
    11
    Likes Received:
    0
    Reputations:
    -1
    вот

    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart;

    type
    TForm1 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Chart1: TChart;
    Series1: TLineSeries;
    Series2: TLineSeries;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}
    procedure TForm1.Button1Click(Sender: TObject);
    function f(x:real):real;
    begin
    f:=5-20*x;
    end;
    var
    f1,per,t,y0,yn,s,h,ak,y1,y,x,pi:real;
    n,k,i:integer;
    begin
    f1:=2;
    n:=40;
    k:=2;
    pi:=3.1415926;
    x:=2*pi*k*f1;
    per:=0.5;
    h:=per/n;
    y0:=f(t);
    yn:=f(per);
    s:=(y0*sin(x*t)+y*sin(x*per))/2;
    t:=t+h;
    for i:=1 to n-1 do
    begin
    s:=5-20*x+5-20*t*sin(x*t);
    t:=t+h;
    end;
    s:=h*s;
    ak:=(2per)*s;
    Edit1.Text:=FloatToStr(ak);
    Series1.Clear;
    Series2.Clear;
    t:=0;
    for i:=1 to n do
    begin
    y1:=ak*cos(2*3.1416*k*f1*t);
    Series1.AddXY(t,y1,'',ClTeeColor);
    y:=f(t);
    Series2.AddXY(t,y,'',ClTeeColor);
    t:=t+h;
    end;
    end;
    end.