25.05.2017, 16:20
|
Прохожий
|
|
Регистрация: 27.02.2017
Сообщения: 4
Версия Delphi: Delphi 7
Репутация: 10
|
|
Вот код для одномерного массива.. Это надо как-то запихнуть в двумерный, чтоб считало массив любой размеренности... Буду ужасно балгодарен
Цитата:
Сообщение от APPEH
Доброго времени суток. Делаю курсовую работу по делфи... Почти все сделал, остался один момент... Необходимо перемножить элементы каждого столбца и вывести в новый массив... Вроде как сделал, но только для массива 5х5.. При изменении размеренности не работает. Это надо как-то двумерным массивом..Не могу сообразить, как реализовть в среде.. Заранее спасибо
|
Код:
// for col:=0 to Form2.Stringgrid1.colCount - 5 do
// Form2.StringGrid2.Cells[0,row]:=
// IntToStr(StrToInt(Form2.StringGrid1.Cells[col,0])*
// StrToInt(Form2.StringGrid1.Cells[col,1])*StrToInt(Form2.StringGrid1.Cells[col,2])
// *StrToInt(Form2.StringGrid1.Cells[col,3])*
// StrToInt(Form2.StringGrid1.Cells[col,4]));
// for col:=1 to Form2.Stringgrid1.colCount - 4 do
// Form2.StringGrid2.Cells[1,row]:=
// IntToStr(StrToInt(Form2.StringGrid1.Cells[col,0])*
// StrToInt(Form2.StringGrid1.Cells[col,1])*StrToInt(Form2.StringGrid1.Cells[col,2])
// *StrToInt(Form2.StringGrid1.Cells[col,3])*
// StrToInt(Form2.StringGrid1.Cells[col,4]));
//for col:=2 to Form2.Stringgrid1.colCount - 3 do
// Form2.StringGrid2.Cells[2,row]:=
// IntToStr(StrToInt(Form2.StringGrid1.Cells[col,0])*
// StrToInt(Form2.StringGrid1.Cells[col,1])*StrToInt(Form2.StringGrid1.Cells[col,2])
// *StrToInt(Form2.StringGrid1.Cells[col,3])*
// StrToInt(Form2.StringGrid1.Cells[col,4]));
// for col:=3 to Form2.Stringgrid1.colCount - 2 do
//Form2.StringGrid2.Cells[3,row]:=
// IntToStr(StrToInt(Form2.StringGrid1.Cells[col,0])*
// StrToInt(Form2.StringGrid1.Cells[col,1])*StrToInt(Form2.StringGrid1.Cells[col,2])
// *StrToInt(Form2.StringGrid1.Cells[col,3])*
//StrToInt(Form2.StringGrid1.Cells[col,4]));
// for col:=4 to Form2.Stringgrid1.colCount - 1 do
// Form2.StringGrid2.Cells[4,row]:=
// IntToStr(StrToInt(Form2.StringGrid1.Cells[col,0])*
// StrToInt(Form2.StringGrid1.Cells[col,1])*StrToInt(Form2.StringGrid1.Cells[col,2])
// *StrToInt(Form2.StringGrid1.Cells[col,3])*
// StrToInt(Form2.StringGrid1.Cells[col,4]));
Админ: Пользуемся тегами при оформлении кода!
Последний раз редактировалось Admin, 25.05.2017 в 19:23.
|