При попытку компиляции кода получаю вот такую ошибку. Может кто знает в чем проблема?
Project Project1.exe raised exception class EAccessViolation with message 'Access violation at adress 00401ACD. Red of address 00000000'.
//---------------------------------------------------------------------------
#include <vcl.h>
#include <math.h>
#include <conio.h>
#include <stdio.h>
#include <iostream.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
typedef double (*TFun)(double);
double fun1(double);
double fun2(double);
void Out_Rez(TFun, double, double, double, TMemo*);
double x, r, p1, p, y, t;
double f=1;
int zn = -1, k;
double a = StrToFloat(Form1->Edit1->Text);
double b = StrToFloat(Form1->Edit2->Text);
double h = StrToFloat(Form1->Edit3->Text);
int n = StrToFloat(Form1->Edit4->Text);
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Memo1->Lines->Add("Ëàáîðàòîðíàÿ ðàáîòà 4");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Memo1->Clear();
}
//---------------------------------------------------------------------------
double fun1(double s){
for(x = a; x<=b; x+=h)
{
p1 = s = p = 1;
f=1;
for(k = 1; k<=n; k++)
{
f=f*k;
s=pow(-1,k+1)*(pow(x,2*k))/(2*k*(2*k-1));
p+=s;
}
}
Form1->Memo1->Lines->Add("при x= "+FloatToStrF(x,ffFixed,8,2)+" s = "+FloatToStrF(p,ffFixed,8,5)
+" y = "+FloatToStrF(y,ffFixed,8,5)+" Разность модуля ="+FloatToStrF(p1,ffFixed,8,5));
}
double fun2(double y){
y=-log(sqrt(1+pow(x,2)))+x*atan(x);
Form1->Memo1->Lines->Add("при x= "+FloatToStrF(x,ffFixed,8,2)+" s = "+FloatToStrF(p,ffFixed,8,5)
+" y = "+FloatToStrF(y,ffFixed,8,5)+" Разность модуля ="+FloatToStrF(p1,ffFixed,8,5));
}