Your SlideShare is downloading. ×
Presentación de matrices
Presentación de matrices
Presentación de matrices
Presentación de matrices
Presentación de matrices
Presentación de matrices
Presentación de matrices
Presentación de matrices
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Presentación de matrices

375

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
375
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1.
  • 2. unit Unit1;
    Interface
    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, Grids;
    type
    TForm1 = class(TForm)
    Caja_Dimension: TEdit;
    Label2: TLabel;
    Label3: TLabel;
    Rejilla: TStringGrid;
    Boton_Llenar: TButton;
    Boton_Validar: TButton;
    Boton_Salir: TButton;
    Label4: TLabel;
    Eti_Resultado: TLabel;
    procedureBoton_SalirClick(Sender: TObject);
    procedureBoton_LlenarClick(Sender: TObject);
    procedureBoton_ValidarClick(Sender: TObject);
    private
    { Privatedeclarations }
    public
    { Publicdeclarations }
    end;
  • 3. type
    Arreglo_Matriz = Array [1..10,1..10] of real;
    var
    Form1: TForm1;
    Matriz_A: Arreglo_Matriz;
    implementation
    {$R *.dfm}
  • 4. ProcedureLlenar_Matriz (outArreglo:Arreglo_Matriz; Cont:Integer);
    var
    fila,columna:integer;
    begin
    for fila:=1 toCont do
    for columna:=1 toCont do
    Arreglo[fila,columna]:=StrtoFloat(inputbox('Llenando Arreglo','Intro elemento ['+inttostr(fila)+','+inttostr(columna)+']',''));
    end;
  • 5. procedureCargar_Rejilla ( Arreglo:Arreglo_Matriz; Cont:Integer; Rejilla:TStringGrid);
    var
    fila,Columna:integer;
    begin
    for fila:=1 toCont do
    for columna:=1 toCont do
    begin
    Rejilla.Cells[columna-1,fila-1]:=FloatToStr(Arreglo[fila,columna]);
    end;
    end;
  • 6. procedure TForm1.Boton_LlenarClick(Sender: TObject);
    var
    Cantidad:integer;
    begin
    Cantidad:=StrToInt(Caja_Dimension.text);
    Llenar_Matriz(Matriz_A,Cantidad);
    Rejilla.RowCount:=StrtoInt(Caja_Dimension.Text);
    Rejilla.ColCount:=StrtoInt(Caja_Dimension.Text);
    Cargar_Rejilla(Matriz_A,Cantidad,Rejilla);
    end;
  • 7. procedure TForm1.Boton_ValidarClick(Sender: TObject);
    var
    Cantidad,fila,columna:integer;
    Valida:boolean;
    begin
    Valida:=true;
    Cantidad:=StrToInt(Caja_Dimension.text);
    for fila:=1 to Cantidad do
    for columna:=1 to Cantidad do
    begin
    If (fila <> columna) and (Matriz_A[fila,columna] <> 0) then
    Valida:=false;
    end;
    If (Valida = true) then
    Eti_Resultado.Caption:= 'Esta es una Matriz DIAGONAL'
    else
    Eti_Resultado.Caption:= 'NO es una Matriz DIAGONAL';
    end;
  • 8. procedure TForm1.Boton_SalirClick(Sender: TObject);
    Begin
    Showmessage (‘El programa a finalizado’);
    Close;
    end;
    end.

×