47341 (608223), страница 3
Текст из файла (страница 3)
System::Windows::Forms::MenuItem* __mcTemp__1[] = new System::Windows::Forms::MenuItem*[1];
__mcTemp__1[0] = this->menuItem1;
this->mainMenu1->MenuItems->AddRange(__mcTemp__1);
//
// menuItem1
//
this->menuItem1->Index = 0;
System::Windows::Forms::MenuItem* __mcTemp__2[] = new System::Windows::Forms::MenuItem*[11];
__mcTemp__2[0] = this->menuItem2;
__mcTemp__2[1] = this->menuItem3;
__mcTemp__2[2] = this->menuItem4;
__mcTemp__2[3] = this->menuItem5;
__mcTemp__2[4] = this->menuItem6;
__mcTemp__2[5] = this->menuItem7;
__mcTemp__2[6] = this->menuItem8;
__mcTemp__2[7] = this->menuItem9;
__mcTemp__2[8] = this->menuItem10;
__mcTemp__2[9] = this->menuItem11;
__mcTemp__2[10] = this->menuItem12;
this->menuItem1->MenuItems->AddRange(__mcTemp__2);
this->menuItem1->Shortcut = System::Windows::Forms::Shortcut::Alt0;
this->menuItem1->Text = S"OPERATIONS";
//
// menuItem2
//
this->menuItem2->Index = 0;
this->menuItem2->Shortcut = System::Windows::Forms::Shortcut::AltF1;
this->menuItem2->Text = S"A*B";
this->menuItem2->Click += new System::EventHandler(this, button1_Click);
//
// menuItem3
//
this->menuItem3->Index = 1;
this->menuItem3->Shortcut = System::Windows::Forms::Shortcut::AltF2;
this->menuItem3->Text = S"A+B";
this->menuItem3->Click += new System::EventHandler(this, button2_Click);
//
// menuItem4
//
this->menuItem4->Index = 2;
this->menuItem4->Shortcut = System::Windows::Forms::Shortcut::AltF3;
this->menuItem4->Text = S"A-B";
this->menuItem4->Click += new System::EventHandler(this, button3_Click);
//
// menuItem5
//
this->menuItem5->Index = 3;
this->menuItem5->Shortcut = System::Windows::Forms::Shortcut::AltF4;
this->menuItem5->Text = S"A*const";
this->menuItem5->Click += new System::EventHandler(this, button4_Click);
//
// menuItem6
//
this->menuItem6->Index = 4;
this->menuItem6->Shortcut = System::Windows::Forms::Shortcut::AltF5;
this->menuItem6->Text = S"A/const";
this->menuItem6->Click += new System::EventHandler(this, button5_Click);
//
// menuItem7
//
this->menuItem7->Index = 5;
this->menuItem7->Shortcut = System::Windows::Forms::Shortcut::AltF6;
this->menuItem7->Text = S"detA";
this->menuItem7->Click += new System::EventHandler(this, button6_Click);
//
// menuItem8
//
this->menuItem8->Index = 6;
this->menuItem8->Shortcut = System::Windows::Forms::Shortcut::AltF7;
this->menuItem8->Text = S"A^-1";
this->menuItem8->Click += new System::EventHandler(this, button7_Click);
//
// menuItem9
//
this->menuItem9->Index = 7;
this->menuItem9->Shortcut = System::Windows::Forms::Shortcut::AltF8;
this->menuItem9->Text = S"transpA";
this->menuItem9->Click += new System::EventHandler(this, button8_Click);
//
// menuItem10
//
this->menuItem10->Index = 8;
this->menuItem10->Shortcut = System::Windows::Forms::Shortcut::AltF9;
this->menuItem10->Text = S"|| A ||";
this->menuItem10->Click += new System::EventHandler(this, button9_Click);
//
// menuItem11
//
this->menuItem11->Index = 9;
this->menuItem11->Shortcut = System::Windows::Forms::Shortcut::AltF10;
this->menuItem11->Text = S"traceA";
this->menuItem11->Click += new System::EventHandler(this, button10_Click);
//
// button10
//
this->button10->BackColor = System::Drawing::Color::LightSkyBlue;
this->button10->Location = System::Drawing::Point(264, 136);
this->button10->Name = S"button10";
this->button10->Size = System::Drawing::Size(48, 23);
this->button10->TabIndex = 21;
this->button10->Text = S"trace";
this->button10->Click += new System::EventHandler(this, button10_Click);
//
// button11
//
this->button11->BackColor = System::Drawing::Color::LightSkyBlue;
this->button11->Location = System::Drawing::Point(344, 136);
this->button11->Name = S"button11";
this->button11->Size = System::Drawing::Size(48, 23);
this->button11->TabIndex = 22;
this->button11->Text = S"cond";
this->button11->Click += new System::EventHandler(this, button11_Click);
//
// menuItem12
//
this->menuItem12->Index = 10;
this->menuItem12->Shortcut = System::Windows::Forms::Shortcut::AltF11;
this->menuItem12->Text = S"condA";
this->menuItem12->Click += new System::EventHandler(this, button11_Click);
//
// Form1
//
this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
this->BackColor = System::Drawing::Color::SteelBlue;
this->ClientSize = System::Drawing::Size(520, 266);
this->Controls->Add(this->button11);
this->Controls->Add(this->button10);
this->Controls->Add(this->button9);
this->Controls->Add(this->button8);
this->Controls->Add(this->button7);
this->Controls->Add(this->button6);
this->Controls->Add(this->button5);
this->Controls->Add(this->button4);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->textBox6);
this->Controls->Add(this->textBox5);
this->Controls->Add(this->textBox4);
this->Controls->Add(this->textBox3);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label6);
this->Controls->Add(this->label5);
this->Controls->Add(this->label4);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Cursor = System::Windows::Forms::Cursors::Hand;
this->Menu = this->mainMenu1;
this->Name = S"Form1";
this->Text = S"MATRIX CALCULATOR";
this->Load += new System::EventHandler(this, Form1_Load);
this->ResumeLayout(false);
}
private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{
}
private: System::Void textBox3_TextChanged(System::Object * sender, System::EventArgs * e){}
private: System::Void textBox6_TextChanged(System::Object * sender, System::EventArgs * e){}
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
int i,j,l;
double **A,**B,**C,smm;
int n=Convert::ToInt32(textBox4->Text);
A = new double*[n];
B = new double*[n];
C = new double*[n];
for(i=0;i { A[i] = new double[n]; B[i] = new double[n]; C[i] = new double[n]; } { GET_ARRAY(textBox1->Text,A,n); GET_ARRAY(textBox2->Text,B,n); for(i=0;i for(j=0;j { smm=0; for(l=0;l smm+=A[i][l]*B[l][j]; C[i][j]=smm; } textBox3->Text=CNV_ARRAY(C,n); textBox3->Invalidate(); textBox3->Update(); } } private: System::Void button2_Click(System::Object * sender, System::EventArgs * e) { int i,j; double **A,**B,**C; int n=Convert::ToInt32(textBox4->Text); A=new double *[n]; B=new double *[n]; C=new double *[n]; for(i=0;i { A[i]=new double[n]; B[i]=new double[n]; C[i]=new double[n]; } GET_ARRAY(textBox1->Text,A,n); GET_ARRAY(textBox2->Text,B,n); for(i=0;i for(j=0;j { C[i][j]=A[i][j]+B[i][j]; } textBox3->Text=CNV_ARRAY(C,n); textBox3->Invalidate(); textBox3->Update(); } private: System::Void button3_Click(System::Object * sender, System::EventArgs * e) { int i,j; double **A,**B,**C; int n=Convert::ToInt32(textBox4->Text); A=new double*[n]; B=new double*[n]; C=new double*[n]; for(i=0;i { A[i]=new double[n]; B[i]=new double[n]; C[i]=new double[n]; } GET_ARRAY(textBox1->Text,A,n); GET_ARRAY(textBox2->Text,B,n); for(i=0;i for(j=0;j { C[i][j]=A[i][j]-B[i][j]; } textBox3->Text=CNV_ARRAY(C,n); textBox3->Invalidate(); textBox3->Update(); } private: System::Void button4_Click(System::Object * sender, System::EventArgs * e) { int i,j; double **A,**C; int n=Convert::ToInt32(textBox4->Text); double cnst=Convert::ToDouble(textBox5->Text); A=new double*[n]; C=new double*[n]; for(i=0;i { A[i]=new double[n]; C[i]=new double[n]; } GET_ARRAY(textBox1->Text,A,n); for(i=0;i for(j=0;j { C[i][j]=cnst*A[i][j]; } textBox3->Text=CNV_ARRAY(C,n); textBox3->Invalidate(); textBox3->Update(); } private: System::Void button5_Click(System::Object * sender, System::EventArgs * e) { int i,j; double **A,**C,g; int n=Convert::ToInt32(textBox4->Text); double cnst=Convert::ToDouble(textBox5->Text); A=new double*[n]; C=new double*[n]; for(i=0;i { A[i]=new double[n]; C[i]=new double[n]; } GET_ARRAY(textBox1->Text,A,n); for(i=0;i for(j=0;j { g=1/cnst; C[i][j]=g*A[i][j]; } textBox3->Text=CNV_ARRAY(C,n); textBox3->Invalidate(); textBox3->Update(); } private: System::Void button6_Click(System::Object * sender, System::EventArgs * e) { int i; double **A,d; int n=Convert::ToInt32(textBox4->Text); A=new double*[n]; for(i=0;i { A[i]=new double[n]; } GET_ARRAY(textBox1->Text,A,n); d=DET(A,n); textBox6->Text=Convert::ToString(d); textBox6->Invalidate(); textBox6->Update(); } private: System::Void button8_Click(System::Object * sender, System::EventArgs * e) { int i; double **A,**C; int n=Convert::ToInt32(textBox4->Text); A=new double*[n]; C=new double*[n]; for(i=0;i { A[i]=new double[n]; C[i]=new double[n]; } GET_ARRAY(textBox1->Text,A,n); TRANSP_ARRAY(A,n); textBox3->Text=CNV_ARRAY(A,n); textBox3->Invalidate(); textBox3->Update(); } private: System::Void button9_Click(System::Object * sender, System::EventArgs * e) { int i,j; double **A,sum=0; int n=Convert::ToInt32(textBox4->Text); A=new double*[n]; for(i=0;i { A[i]=new double[n]; } GET_ARRAY(textBox1->Text,A,n); for(i=0;i { for(j=0;j { sum+=System::Math::Abs(A[i][j]); } } textBox6->Text=Convert::ToString(sum); textBox6->Invalidate(); textBox6->Update(); } private: System::Void button7_Click(System::Object * sender, System::EventArgs * e) { int i,j; double **A,**C,a,as,ad,d,h; int n=Convert::ToInt32(textBox4->Text); A=new double*[n]; C=new double*[n]; for(i=0;i { A[i]=new double[n]; C[i]=new double[n]; } GET_ARRAY(textBox1->Text,A,n); d=DET(A,n); for(i=0;i for(j=0;j { h=1/d; a=A[i][j]; ad=ALG_DOP(A,n,i,j); as=a*ad; C[i][j]=h*as; } TRANSP_ARRAY(C,n); textBox3->Text=CNV_ARRAY(C,n); textBox3->Invalidate(); textBox3->Update(); } private: System::Void button10_Click(System::Object * sender, System::EventArgs * e) { int i; double **A,tr; int n=Convert::ToInt32(textBox4->Text); A=new double*[n]; for(i=0;i { A[i]=new double[n]; } GET_ARRAY(textBox1->Text,A,n); tr=TRACE(A,n); textBox6->Text=Convert::ToString(tr); textBox6->Invalidate(); textBox6->Update(); } private: System::Void button11_Click(System::Object * sender, System::EventArgs * e) { int i,j; double **A,**C,a,as,ad,d,h; int n=Convert::ToInt32(textBox4->Text); A=new double*[n]; C=new double*[n]; for(i=0;i { A[i]=new double[n]; C[i]=new double[n]; } GET_ARRAY(textBox1->Text,A,n); d=DET(A,n); if(d!=0) { for(i=0;i for(j=0;j { h=1/d; a=A[i][j]; ad=ALG_DOP(A,n,i,j); as=a*ad; C[i][j]=h*as; } } TRANSP_ARRAY(C,n); double sum=0,mus=0,S=0; for(i=0;i { for(j=0;j {