Расчетно-графическая работа по программированию — страница 5

  • Просмотров 2908
  • Скачиваний 274
  • Размер файла 24
    Кб

Resform->sg3->RowCount=res.Getx(); Resform->sg3->ColCount=res.Gety(); for(int i=0; i<res.Getx(); i++) for (int j=0; j<res.Gety(); j++) res.matr[i][j].videlen(); for (int i=0; i<res.Getx(); i++) for (int j=0; j<res.Gety(); j++) { Resform->sg3->Cells[j][i]=IntToStr(res.matr[i][j].cel)+ "*"+IntToStr(res.matr[i][j].chisl)+ "/"+IntToStr(res.matr[i][j].znamen); } Resform->Box1->Visible=true; Resform->ShowModal(); if (Resform->Box1->Checked) { matrix res1=Transposing (second); Resform->sg3->RowCount=res1.Getx(); Resform->sg3->ColCount=res1.Gety(); for(int i=0; i<res1.Getx(); i++) for (int j=0; j<res1.Gety(); j++) res1.matr[i][j].videlen(); for (int i=0; i<res1.Getx(); i++) for (int j=0;

j<res1.Gety(); j++) { Resform->sg3->Cells[j][i]=IntToStr(res1.matr[i][j].cel)+ "*"+IntToStr(res1.matr[i][j].chisl)+ "/"+IntToStr(res1.matr[i][j].znamen); } Resform->Box1->Visible=false; Resform->ShowModal(); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::Btn3Click(TObject *Sender) { Analisation ob,ob1; matrix first (n,m); matrix second (k,l); first.Read(sg1,ob); second.Read(sg2,ob1); if (first.Getx()==second.Getx() && first.Gety()==second.Gety()) { matrix res=first+second; Resform->sg3->RowCount=res.Getx(); Resform->sg3->ColCount=res.Gety(); for (int i=0; i<res.Getx(); i++) for (int j=0; j<res.Gety(); j++) res.matr[i][j].videlen(); for (int i=0;

i<res.Getx(); i++) for (int j=0; j<res.Gety(); j++) { Resform->sg3->Cells[j][i]=""; Resform->sg3->Cells[j][i]=IntToStr(res.matr[i][j].cel)+"*"+ IntToStr(res.matr[i][j].chisl)+ "/"+IntToStr(res.matr[i][j].znamen); } Resform->ShowModal(); } else MessageBox (NULL,"Ну кто так складывает","ЧАЙНИК!!",MB_ICONEXCLAMATION ); } //--------------------------------------------------------------------------- void __fastcall TMainForm::C1Click(TObject *Sender) { for (int i=0; i<sg1->RowCount; i++) for (int j=0; j<sg1->ColCount; j++) sg1->Cells[j][i]=IntToStr(1+random(6))+ "/"+IntToStr(1+random(6)); } //---------------------------------------------------------------------------

void __fastcall TMainForm::C2Click(TObject *Sender) { for (int i=0; i<sg2->RowCount; i++) for (int j=0; j<sg2->ColCount; j++) sg2->Cells[j][i]=IntToStr(1+random(6))+ "/"+IntToStr(1+random(6)); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Btn4Click(TObject *Sender) { Analisation ob,ob1; matrix first (n,m); matrix second (k,l); first.Read(sg1,ob); second.Read(sg2,ob1); if (first.Getx()==second.Getx() && first.Gety()==second.Gety()) { matrix res=first-second; Resform->sg3->RowCount=res.Getx(); Resform->sg3->ColCount=res.Gety(); for (int i=0; i<res.Getx(); i++) for (int j=0; j<res.Gety(); j++) res.matr[i][j].videlen(); for (int i=0; i<res.Getx(); i++) for (int j=0;

j<res.Gety(); j++) { Resform->sg3->Cells[j][i]=""; Resform->sg3->Cells[j][i]=IntToStr(res.matr[i][j].cel)+"*"+ IntToStr(res.matr[i][j].chisl)+ "/"+IntToStr(res.matr[i][j].znamen); } Resform->ShowModal(); } else MessageBox (NULL,"Ну кто так отнимает","ЧАЙНИК!!",MB_ICONEXCLAMATION ); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N1Click(TObject *Sender) { for (int i=0; i<sg1->RowCount; i++) for (int j=0; j<sg1->ColCount; j++) sg1->Cells[j][i]=""; Panel1->Caption=""; } //--------------------------------------------------------------------------- void __fastcall TMainForm::N2Click(TObject *Sender)

{ for (int i=0; i<sg2->RowCount; i++) for (int j=0; j<sg2->ColCount; j++) sg2->Cells[j][i]=""; Panel2->Caption=""; } //--------------------------------------------------------------------------- void __fastcall TMainForm::Btn5Click(TObject *Sender) { Nunit->ShowModal(); Analisation ob,ob1,ob2; chislo=ob.MAIN(Nunit->Edit->Text.c_str()); matrix first (n,m); matrix second (k,l); first.Read(sg1,ob1); second.Read(sg2,ob2); matrix res1 (first.Getx(), first.Gety()); matrix res2 (second.Getx(), second.Gety()); if (Nunit->RBtn1->Checked) { res1=first.operator *(chislo); for (int i=0; i<res1.Getx(); i++) for (int j=0; j<res1.Gety(); j++) res1.matr[i][j].videlen(); Resform->sg3->RowCount=res1.Getx();