Witam mam taki problem że każdej kolumny liczę sumę i zapisuje ją na 1 wierszu danej kolumny a iloczyn 1 kolumnie danego wiersza, a problem polega na tym że wynik przesuwa się o 1, mógł by to ktoś naprawić ?? Dołączam grafika dla objaśnienia.
void __fastcall TForm1::StringGrid1Click(TObject *Sender)
{
int i,j;
for (i=1;i<4;i++)
for (j=1;j<8;j++)
StringGrid1->Cells[i][j]=random(9)+1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
int i,j,s,a;
s=0;
for (i=1;i<4;i++)
for (j=1;j<8;j++)
{
s=s+StrToInt(StringGrid1->Cells[i][j]);
StringGrid1->Cells[i+1][0]=s;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
{
int i,j,s,a;
s=0;
for (i=1;i<4;i++)
for (j=1;j<8;j++)
{
s=s*StrToInt(StringGrid1->Cells[i][j]); // dałem mnozenie(*) i wywala 0 a jak jest + to działa
StringGrid1->Cells[0][j+1]=s;
}
}
}