Интерфейс пользователя
#pragma package(smart_init) #pragma resource "*.dfm"*Form1;flag=false;check=false;S;y;g;X[10][10];W[10][10]; //--------------------------------------------------------------------------- fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- fastcall TForm1::FormCreate(TObject *Sender) {-> Canvas -> Brush -> Color = clWhite;-> DoubleBuffered = true;(int i=0;i<10;i++){(int j=0;j<10;j++){[i][j]=(rand()%7 - 3)/10.0; //(((-1)*rand()%7/10)+(rand()%7/10)); } } } //--------------------------------------------------------------------------- fastcall TForm1::Image1MouseMove(TObject *Sender, TShiftState Shift,X, int Y) {-> Canvas -> Pen -> Color = clBlack;-> Canvas -> Pen->Width=5;(flag) Image1 -> Canvas -> LineTo(X, Y); } //--------------------------------------------------------------------------- fastcall TForm1::Image1MouseDown(TObject *Sender,Button, TShiftState Shift, int X, int Y) {= true;-> Canvas -> MoveTo(X, Y); } //--------------------------------------------------------------------------- fastcall TForm1::Image1MouseUp(TObject *Sender, TMouseButton Button,Shift, int X, int Y) {= false; } //--------------------------------------------------------------------------- fastcall TForm1::BitBtn4Click(TObject *Sender) {->Canvas->FillRect(Rect(0,0,Image1->Width,Image1->Height)); } //--------------------------------------------------------------------------- fastcall TForm1::BitBtn1Click(TObject *Sender) {(int a=0;a<10;a++)(int b=0;b<10;b++)[a][b]=0; for (int a=0; a<10;a++) // проход 10х10 по квадратикам 30х30 { int n=30;k=0;(int b=0; b<10;b++) {(int i=k; i<n; i++){ l=a*30; int m=l+30; // проход по квадрату 30х30 for (int j=l; j<m; j++) {( Form1->Image1->Canvas->Pixels[i][j]== clBlack ) {[a][b] = 1; } }; }=n;=k+30; } }=0;(int a=0; a<10;a++){(int b=0; b<10;b++) {=S+X[a][b]*W[a][b]; } }(S>0) {>MessageBox("Это треугольник!","Сообщение",MB_ICONINFORMATION);=1; }{>MessageBox("Это круг!","Сообщение",MB_ICONINFORMATION);=0; } } //--------------------------------------------------------------------------- fastcall TForm1::BitBtn2Click(TObject *Sender) {(y==1) g=-1;(y==0) g=1;(int a=0; a<10;a++){(int b=0; b<10;b++) {[a][b]=W[a][b]+1/2*g*X[a][b]; } }(int i=0;i<10;i++){(int j=0;j<10;j++){->Cells[j][i]=X[i][j]; } } } //---------------------------------------------------------------------------
Перейти на страницу: 1 2
|