#1




me very really need help with matrix programming. help me please
HELP!!!
Ok, I need to develop an algorythm, code and the interface for an electronic package, who will enter the matrix nxm in random numbers from 0 to 55 and who will find the minimum and the maximum as numbers. Need to be writen in a form. Thank you very much!!! Last edited by Gromopetr; 04302018 at 04:08 PM. 
#2




We love school assignments...
What have you got so far and what are the problems you encounter? Not sure how you get your "electronic package" and what "matrix mxn" is, so perhaps if you provide what you've got so far it will become more understandable 
#3




Quote:
Unit Rab_4; Interface Uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Grids; type TInputForm = class(TForm) StringGrid1: TStringGrid; StringGrid2: TStringGrid; StringGrid3: TStringGrid; Label1: TLabel; Edit1: TEdit; Button1: TButton; Button2: TButton; Procedure FormCreate(Sender: TObject); Procedure Button1Click(Sender: TObject); Procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; const Nmax = 10; // The maximum dimension of an array type Mas1 = array[1..Nmax] of Extended; // Declaring the type of a onedimensional array Mas2 = array[1..Nmax, 1..Nmax] of Extended; // Declaring the type of a twodimensional array var InputForm: TInputForm; A : Mas2; // Declaring a twodimensional array B, Y : Mas1; // Declaring onedimensional arrays N, i, j : integer; Implementation {$R *.DFM} Procedure TInputForm.FormCreate(Sender: TObject); begin N := 3; // Array Dimension Edit1.Text := FloatToStr(N); // Specifying the number of rows and columns StringGrid1.ColCount := N + 1; StringGrid1.RowCount := N + 1; StringGrid2.RowCount := N + 1; StringGrid3.RowCount := N + 1; // Enter the name of the array in the upper left cell of the table StringGrid1.Cells[0, 0] := 'Массив A'; StringGrid2.Cells[0, 0] := 'Массив B'; StringGrid3.Cells[0, 0] := 'Массив Y'; // Filling of the upper and left columns with explanatory inscriptions for i:=1 to N do begin StringGrid1.Cells[0, i] := 'i='+ IntToStr(i); StringGrid1.Cells[i, 0] := 'j='+ IntToStr(i); end; end; Procedure TInputForm.Button1Click(Sender: TObject); begin N := StrToInt(Edit1.Text); // Specifying the Number of Rows and Columns in Tables StringGrid1.ColCount := N + 1; StringGrid1.RowCount := N + 1; StringGrid2.RowCount := N + 1; StringGrid3.RowCount := N + 1; // Filling of the upper and left columns with explanatory inscriptions for i:=1 to N do begin StringGrid1.Cells[0, i] := 'i=' + IntToStr(i); StringGrid1.Cells[i, 0] := 'j=' + IntToStr(i); end; end; Procedure TInputForm.Button2Click(Sender: TObject); var s : extended; begin // Filling an array A with elements from a table StringGrid1 for i:=1 to N do for j:=1 to N do A[i, j] := StrToFloat(StringGrid1.Cells[j, i]); // Filling an array B with elements from a table StringGrid2 for i:=1 to N do B[i] := StrToFloat(StringGrid2.Cells[0, i]); // Multiplication of array A by array B for i:=1 to N do begin s := 0; for j:=1 to N do s := s + A[i, j]*B[j]; Y[i] := s; // outputting the result to a table StringGrid3 StringGrid3.Cells[0, i] := FloatToStrF(Y[i], ffFixed,6,2); end; end; end. 
#4




A nice piece of code, but what are the problems in this, what are the parts that don't work as expected?
And naming conventions are a must, ButtonX, StringGridX, what are it's purposes? As for the min and max value of an Array I would take a look at the Math unit (just add Math to the uses). It has MinIntValue and MaxIntValue already implemented. 
#5




Matrix help
The problem is that I do not understand how to write it

Thread Tools  
Display Modes  

