Forum > Beginners
Gaussian Elimination
(1/1)
jcaser1948:
I try to convert some of my old TP programs to FP and Visual input.
For the Matrix input I had the following Code
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Input(Var N: Integer; Var Coeff_Mat1: Mat_Array; Var Col_Mat1: Col_Array); (*** This Procedure lets the user input the number of equations and the ***)(*** augmented matrix of their system of equations ***)(*** ON ENTRY : N => number of equations : UNDEFinED Coeff_Mat1 => coefficient matrix : UNDEFinED Col_Mat1 => column matrix :UNDEFinED ON Exit : N => # of equations input by user Coeff_Mat1 => defined coefficient matrix Col_Mat1 => defined column matrix input by user ***) Var I,J : Integer; (* loop control and Array indices *) begin // readln(N); For I := 1 to N do { row indice } begin Writeln('ROW #',I); For J := 1 to N do {column indice } begin Write('a(',I,',',J,'):'); readln(Coeff_Mat1[I,J]); {input of coefficient matrix} end; Write('c(',I,'):'); readln(Col_Mat1[I]); {input of Constant matrix} end; readln;end; (* Procedure Input *){---------------------------------------------------------------------------}Has anyone an Idea how this Input can be achieved with visual Controls in a simple way?Can I Use T stringGird? The size of the matrices is variable , the max numbers of equations 50 .If I use TStringGird Can I change the quantity of rows and columns dynamically im Program ,depending on the number of equations N given by the User?
Thanks for the help
wp:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure PrepareMatrixGrid(AGrid: TStringGrid; N: Integer);var i, j: Integer;begin AGrid.ColCount := N + AGrid.FixedCols; AGrid.RowCount := N + AGrid.FixedRows; // Add column headers: 1, 2, 3, ... for i:=AGrid.FixedCols to AGrid.ColCount-1 do AGrid.Cells[i, 0] :=IntToStr(i - AGrid.FixedCols + 1); // Add row headers: 1, 2, 3, ... for i:=AGrid.FixedRows to AGrid.RowCount-1 do AGrid.Cells[0, i] := IntToStr(i - AGrid.FixedRows + 1]); // Preset every cell Aij with 0 for j:=AGrid.FixedRows to AGrid.RowCount-1 do for i := AGrid.FixedCols to AGrid.ColCount-1 do Cells[i, j] := '0';end;
jcaser1948:
Thans,It works fine
Navigation
[0] Message Index