Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- implementation
- {$R *.dfm}
- procedure TForm2.BtnResClick(Sender: TObject);
- var
- Arr: array of array of Integer;
- ArrB: array of Integer;
- i, j, k, m, d, s: Integer;
- Amount: Integer;
- Element, Total: Integer;
- begin
- LenI := StrToInt(EdtRows.Text);
- LenJ := StrToInt(EdtCols.Text);
- SetLength(Arr, LenI, LenJ);
- SetLength(ArrB, LenJ);
- k := 0;
- Total := 0;
- for i := 0 to LenI - 1 do
- for j := 0 to LenJ - 1 do
- Arr[i, j] := StrToInt(StringGrid1.Cells[j, i]);
- for i := 0 to LenI - 1 do
- begin
- Amount := 0;
- for j := 0 to LenJ - 1 do
- begin
- Element := Arr[i,j];
- if (Element = Arr[i,j]) then
- begin
- inc(Amount);
- Total := Total + Amount;
- for d := 0 to Length(ArrB) - 1 do
- if Element <> ArrB[k] then
- begin
- ArrB[k] := Element;
- end;
- end;
- for m := (Total - Amount) to Total - 1 do
- StringGrid2.Cells[m, i] := IntToStr(ArrB[k]);
- inc(k);
- //Amount := 0;
- end;
- for s := 0 to Length(ArrB)-1 do
- ArrB[s] := 0;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement