Жйелерді модельдеу
.pdfФ-ОБ-001/033
[HistoryLists\hlConditionals]
Count=1 Item0=_DEBUG
[Debugging] DebugSourceDirs=$(BCB)\source\vcl
[Parameters]
RunParams=
Launcher=
UseLauncher=0
DebugCWD=
HostApplication=
RemoteHost=
RemotePath=
RemoteLauncher=
RemoteCWD=
RemoteDebug=0
[Compiler]
ShowInfoMsgs=0
LinkDebugVcl=0
LinkCGLIB=0
[CORBA]
AddServerUnit=1
AddClientUnit=1
PrecompiledHeaders=1
</IDEOPTIONS>
</PROJECT>
43
Ф-ОБ-001/033
//---------------------------------------------------------------------------
#include <vcl.h> #pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("Unit1.cpp", Form1); //---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize(); Application->CreateForm(__classid(TForm1), &Form1); Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include <vcl.h> #include <math.h> #pragma hdrstop
#include "Unit1.h" //---------------------------------------------------------------------------
#pragma package(smart_init)
44
Ф-ОБ-001/033
#pragma resource "*.dfm" TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
float a,b; a=StrToFloat(Edit1->Text); b=StrToFloat(Edit2->Text); float x=1/a;
float p=x*b; float n=p/(1-p);
float d=p/((1-p)*(1-p)); float w=(p/a)/(1-p); float t=x+w;
float N=b*t;
Label4->Caption="x = "+FloatToStr(x);
Label5->Caption="p = "+FloatToStr(p);
Label6->Caption="n = "+FloatToStr(n);
Label7->Caption="D = "+FloatToStr(d);
Label8->Caption="W = "+FloatToStr(w);
Label9->Caption="T = "+FloatToStr(t); Label11->Caption="N = "+FloatToStr(N); PageControl1->Visible=true;
int k; float pk; Series1->Clear(); for(k=0;k<=100;k++)
{
pk=(1-p)*pow(p,k); Series1->AddXY(k,pk,"",clRed);
}
Chart1->Visible=true;
}
//---------------------------------------------------------------------------
45
Ф-ОБ-001/033
//---------------------------------------------------------------------------
#include <vcl.h> #include <math.h> #pragma hdrstop
#include "Unit1.h" //---------------------------------------------------------------------------
#pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
float a,b; a=StrToFloat(Edit1->Text); b=StrToFloat(Edit2->Text); float x=1/a;
float p=x*b; float n=p/(1-p);
float d=p/((1-p)*(1-p)); float w=(p/a)/(1-p); float t=x+w;
float N=b*t;
Label4->Caption="x = "+FloatToStr(x);
Label5->Caption="p = "+FloatToStr(p);
Label6->Caption="n = "+FloatToStr(n);
Label7->Caption="D = "+FloatToStr(d);
Label8->Caption="W = "+FloatToStr(w);
Label9->Caption="T = "+FloatToStr(t); Label11->Caption="N = "+FloatToStr(N); PageControl1->Visible=true;
int k; float pk; Series1->Clear(); for(k=0;k<=100;k++)
{
pk=(1-p)*pow(p,k); Series1->AddXY(k,pk,"",clRed);
46
Ф-ОБ-001/033
}
}
//---------------------------------------------------------------------------
object Form1: TForm1 Left = 192
Top = 124
Width = 928
Height = 415 Caption = 'Form1' Color = clBtnFace
Font.Charset = RUSSIAN_CHARSET Font.Color = clWindowText Font.Height = -19
Font.Name = 'Times New Roman' Font.Style = []
OldCreateOrder = False PixelsPerInch = 96 TextHeight = 21 object Label1: TLabel Left = 16
Top = 56
Width = 54
Height = 21
Caption = #1052'('#1084#1102')' end
object Label2: TLabel Left = 16
Top = 96
Width = 83
Height = 21
Caption = #1051'('#1083#1103#1084#1073#1076#1072')' end
object Label3: TLabel Left = 120
Top = 16 Width = 129 Height = 21
Caption = #1042#1074#1077#1076#1080#1090#1077' '#1076#1072#1085#1085#1099#1077
end
object Edit1: TEdit Left = 128
47
Ф-ОБ-001/033
Top = 56 Width = 121 Height = 29 TabOrder = 0 end
object Edit2: TEdit Left = 128
Top = 96 Width = 121 Height = 29 TabOrder = 1 end
object Button1: TButton Left = 128
Top = 136
Width = 121
Height = 33
Caption = #1042#1099#1095#1080#1089#1083#1080#1090#1100 TabOrder = 2
OnClick = Button1Click end
object PageControl1: TPageControl Left = 8
Top = 184
Width = 273
Height = 185 ActivePage = TabSheet2
Font.Charset = RUSSIAN_CHARSET Font.Color = clWindowText Font.Height = -13
Font.Name = 'Times New Roman' Font.Style = []
MultiLine = True
ParentFont = False TabIndex = 1 TabOrder = 3 Visible = False
object TabSheet1: TTabSheet
Caption = #1057#1088#1077#1076#1085#1077#1077' '#1074#1088#1077#1084#1103' '#1086#1073#1089#1083#1091#1078#1080#1074#1072#1085#1080#1103
object Label4: TLabel Left = 24
Top = 24
48
Ф-ОБ-001/033
Width = 35
Height = 15 Caption = 'Label4' end
object Label5: TLabel Left = 24
Top = 56
Width = 35
Height = 15 Caption = 'Label5' end
end
object TabSheet2: TTabSheet
Caption = #1057#1088#1077#1076#1085#1077#1077' '#1095#1080#1089#1083#1086' '#1090#1088#1077#1073#1086#1074#1072#1085#1080#1081' '#1074' '#1089#1080#1089#1090#1077#1084#1077
ImageIndex = 1 object Label6: TLabel Left = 24
Top = 24
Width = 35
Height = 15 Caption = 'Label6' end
object Label7: TLabel Left = 24
Top = 56
Width = 35
Height = 15 Caption = 'Label7' end
end
object TabSheet3: TTabSheet
Caption = #1057#1088#1077#1076#1085#1077#1077' '#1079#1072#1076#1077#1088#1078#1082#1080
ImageIndex = 2 object Label8: TLabel Left = 24
Top = 40
Width = 35
Height = 15 Caption = 'Label8' end
49
Ф-ОБ-001/033
end
object TabSheet4: TTabSheet
Caption = #1057#1088#1077#1076#1085#1077#1077' '#1074#1088#1077#1084#1103' '#1087#1088#1077#1073#1099#1074#1072#1085#1080#1103' '#1090#1088#1077#1073#1086#1074#1072#1085#1080#1103
ImageIndex = 3 object Label9: TLabel Left = 24
Top = 24
Width = 35
Height = 15 Caption = 'Label9' end
object Label11: TLabel Left = 24
Top = 56
Width = 41
Height = 15 Caption = 'Label11' end
end end
object Chart1: TChart Left = 304
Top = 48 Width = 593 Height = 313
BackWall.Brush.Color = clWhite BackWall.Brush.Style = bsClear Title.Text.Strings = (
'TChart') TabOrder = 4
object Series1: TLineSeries Marks.ArrowLength = 8 Marks.Visible = False SeriesColor = clRed Pointer.InflateMargins = True Pointer.Style = psRectangle Pointer.Visible = False XValues.DateTime = False XValues.Name = 'X' XValues.Multiplier = 1 XValues.Order = loAscending
50
Ф-ОБ-001/033
YValues.DateTime = False YValues.Name = 'Y' YValues.Multiplier = 1 YValues.Order = loNone end
end end
//---------------------------------------------------------------------------
#ifndef Unit1H #define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <ComCtrls.hpp> #include <Chart.hpp> #include <ExtCtrls.hpp> #include <Series.hpp> #include <TeEngine.hpp> #include <TeeProcs.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components TLabel *Label1;
TEdit *Edit1; TLabel *Label2; TEdit *Edit2; TLabel *Label3; TButton *Button1;
TPageControl *PageControl1; TTabSheet *TabSheet1; TTabSheet *TabSheet2; TTabSheet *TabSheet3; TTabSheet *TabSheet4; TLabel *Label4;
TLabel *Label5;
TLabel *Label6;
51
Ф-ОБ-001/033
TLabel *Label7;
TLabel *Label8;
TLabel *Label9;
TLabel *Label11;
TChart *Chart1; TLineSeries *Series1;
void __fastcall Button1Click(TObject *Sender);
private: |
// User declarations |
public: |
// User declarations |
__fastcall TForm1(TComponent* Owner);
}; //---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1; //---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
#include <vcl.h> #include <math.h> #pragma hdrstop
#include "Unit1.h" //---------------------------------------------------------------------------
#pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
float a,b; a=StrToFloat(Edit1->Text); b=StrToFloat(Edit2->Text); float x=1/a;
float p=x*b;
52