Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Архив3 / OOP_kursach / ООП_курсач.doc
Скачиваний:
96
Добавлен:
07.08.2013
Размер:
393.73 Кб
Скачать

Unit1.Cpp

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit1.h"

#include "Unit2.h"

#include "Unit3.h"

#include "Unit4.h"

#include "File2.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma link "CSPIN"

#pragma resource "*.dfm"

TForm1 *Form1;

//---------------------------------------------------------------------------

__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

{

_Mat1.InitZero();

_Mat2.InitZero();

_SG1_R = 3;

_SG1_C = 3;

_SG2_R = 3;

_SG2_C = 3;

_SGFocus = StringGrid1;

_MatFocus = &_Mat1;

_Memory = 0;

_SGFocusInt = 1;

for (int i = 1; i <= SGMAX; i++)

{

StringGrid1->Cells[i][0] = IntToStr(i);

StringGrid2->Cells[i][0] = IntToStr(i);

StringGrid3->Cells[i][0] = IntToStr(i);

}

for (int i = 1; i <= SGMAX; i++)

{

StringGrid1->Cells[0][i] = IntToStr(i);

StringGrid2->Cells[0][i] = IntToStr(i);

StringGrid3->Cells[0][i] = IntToStr(i);

}

for (int i = 1; i < SGMAX ; i++)

for (int j = 1; j < SGMAX; j++)

{

StringGrid1->Cells[j][i] = "0";

StringGrid2->Cells[j][i] = "0";

StringGrid3->Cells[j][i] = "0";

}

}

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------

void __fastcall TForm1::Button6Click(TObject *Sender)

{

try

{

ReadForm();

_Res.MSumm(_Mat1, _Mat2);

WriteForm();

}

catch (int ExceptCode)

{

ExceptCatch(ExceptCode);

}

}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button5Click(TObject *Sender)

{

try

{

ReadForm();

_Res.MMult(_Mat1, _Mat2);

WriteForm();

}

catch (int ErrCode)

{

ExceptCatch(ErrCode);

}

}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button7Click(TObject *Sender)

{

try

{

ReadForm();

_Res.MDiff(_Mat1, _Mat2);

WriteForm();

}

catch (int ErrCode)

{

ExceptCatch(ErrCode);

}

}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button3_1Click(TObject *Sender)

{

StringGrid1->RowCount = StringGrid3->RowCount;

StringGrid1->ColCount = StringGrid3->ColCount;

Edit1_1->Text = IntToStr(_SG1_R = StringGrid1->RowCount - 1);

Edit1_2->Text = IntToStr(_SG1_C = StringGrid1->ColCount - 1);

_Mat1 = _Res;

Print(1);

}

............................................

И т.д.