Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 07-07-2017
Liz Beli Liz Beli is offline
Registrado
NULL
 
Registrado: jul 2017
Posts: 1
Poder: 0
Liz Beli Va por buen camino
Matriz de 3*3

Hola amigos quisiera ver si alguien me puede ayudar con esto, mi problema es que a la hora de correrlo el resultado no me lo da como si lo hicieras a amano por favor ayuda. Les dejo mi código:


Código Delphi [-]
unit Menu;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, StdCtrls, math;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Grid1: TStringGrid;
    Button4: TButton;
    Button7: TButton;
    Button8: TButton;
    Grid2: TStringGrid;
    Button5: TButton;
    Button6: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Button9: TButton;
    Button10: TButton;
    procedure Button10Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  letra,oper:Integer;
  det1, det11,det2,det3,det21, det31, deter11,deter12, deter21, deter22, deterR,deterI, x1,x2:Real;
  mag, mag1, mag2,ang,ang2, ang1, mag3,mag4,mag5,ang3,ang4,ang5:Real;
  det4,det5,det6,det41,det51,det61:Real;
implementation
uses Rectang,Polar;

{$R *.dfm}

procedure TForm1.Button10Click(Sender: TObject);
begin
  rid2.ColCount:=Grid2.ColCount-1;
  Grid2.RowCount:=Grid2.RowCount-1;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 Form2.ShowModal;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Form3.ShowModal;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  letra:=letra+1;
  if letra<=90 then
  begin
    Grid1.RowCount:=Grid1.RowCount+1;
    Grid1.Cells[0,Grid1.RowCount-1]:=chr(letra);
  end
  else
  begin
    letra:=90;
  end;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  letra:=letra-1;
  if letra>=65 then
  begin
    Grid1.RowCount:=Grid1.RowCount-1;
  end
  else
  begin
    letra:=65;
  end;
end;


procedure TForm1.Button5Click(Sender: TObject);
begin
  if Grid2.RowCount=2 then
  begin
    Grid2.Cells[0,0]:=Grid1.Cells[1,1] + Grid1.Cells[2,1] + 'i';
    Grid2.Cells[0,1]:=Grid1.Cells[1,2] + Grid1.Cells[2,2] + 'i';
    Grid2.Cells[1,0]:=Grid1.Cells[1,3] + Grid1.Cells[2,3] + 'i';
    Grid2.Cells[1,1]:=Grid1.Cells[1,4] + Grid1.Cells[2,4] + 'i';
    Grid2.Cells[2,0]:=Grid1.Cells[1,5] + Grid1.Cells[2,5] + 'i';
    Grid2.Cells[2,1]:=Grid1.Cells[1,6] + Grid1.Cells[2,6] + 'i';
  end;
  if Grid2.RowCount=3 then
  begin
    Grid2.Cells[0,0]:=Grid1.Cells[1,1] + Grid1.Cells[2,1] + 'i';
    Grid2.Cells[0,1]:=Grid1.Cells[1,2] + Grid1.Cells[2,2] + 'i';
    Grid2.Cells[0,2]:=Grid1.Cells[1,3] + Grid1.Cells[2,3] + 'i';
    Grid2.Cells[1,0]:=Grid1.Cells[1,4] + Grid1.Cells[2,4] + 'i';
    Grid2.Cells[1,1]:=Grid1.Cells[1,5] + Grid1.Cells[2,5] + 'i';
    Grid2.Cells[1,2]:=Grid1.Cells[1,6] + Grid1.Cells[2,6] + 'i';
    Grid2.Cells[2,0]:=Grid1.Cells[1,7] + Grid1.Cells[2,7] + 'i';
    Grid2.Cells[2,1]:=Grid1.Cells[1,8] + Grid1.Cells[2,8] + 'i';
    Grid2.Cells[2,2]:=Grid1.Cells[1,9] + Grid1.Cells[2,9] + 'i';
  end;
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
  if Grid2.RowCount=2 then
  begin
    mag:=strtofloat(Grid1.Cells[3,1])*strtofloat(Grid1.Cells[3,4]);
    ang:=strtofloat(Grid1.Cells[4,1])+ strtofloat(Grid1.Cells[4,4]);
    mag1:=strtofloat(Grid1.Cells[3,2])*strtofloat(Grid1.Cells[3,3]);
    ang1:=strtofloat(Grid1.Cells[4,2])+ strtofloat(Grid1.Cells[4,3]);
    det1:=RoundTo(mag*cos(degtorad(ang)), -2);
    det11:=RoundTo(mag*sin(degtorad(ang)), -2);
    det2:=RoundTo(mag1*cos(degtorad(ang1)), -2);
    det21:=RoundTo(mag1*sin(degtorad(ang1)), -2);
    deter11:=det1-det2;
    deter12:=det11-det21;
    Edit1.Text:=floattostr(deter11);
    Edit2.Text:=floattostr(deter12);
  end;
  if Grid2.RowCount=3 then
  begin
    mag:=(strtofloat(Grid1.Cells[3,1])*strtofloat(Grid1.Cells[3,5])*strtofloat(Grid1.Cells[3,9]));
    ang:=(strtofloat(Grid1.Cells[4,1])+strtofloat(Grid1.Cells[4,5])+strtofloat(Grid1.Cells[4,9]));
    mag1:=(strtofloat(Grid1.Cells[3,2])*strtofloat(Grid1.Cells[3,6])*strtofloat(Grid1.Cells[3,7]));
    ang1:=(strtofloat(Grid1.Cells[4,2])+strtofloat(Grid1.Cells[4,6])+strtofloat(Grid1.Cells[4,7]));
    mag2:=(strtofloat(Grid1.Cells[3,3])*strtofloat(Grid1.Cells[3,4])*strtofloat(Grid1.Cells[3,8]));
    ang2:=(strtofloat(Grid1.Cells[4,3])+strtofloat(Grid1.Cells[4,4])+strtofloat(Grid1.Cells[4,8]));
    det1:=RoundTo(mag*cos(degtorad(ang)), -2);
    det11:=RoundTo(mag*sin(degtorad(ang)), -2);
    det2:=RoundTo(mag1*cos(degtorad(ang1)), -2);
    det21:=RoundTo(mag1*sin(degtorad(ang1)), -2);
    det3:=RoundTo(mag2*cos(degtorad(ang2)), -2);
    det31:=RoundTo(mag2*sin(degtorad(ang2)), -2);
    deter11:=det1+det2+det3;
    deter12:=det11+det21+det31;

    mag3:=(strtofloat(Grid1.Cells[3,3])*strtofloat(Grid1.Cells[3,5])*strtofloat(Grid1.Cells[3,7]));
    ang3:=(strtofloat(Grid1.Cells[4,3])+strtofloat(Grid1.Cells[4,5])+strtofloat(Grid1.Cells[4,7]));
    mag4:=(strtofloat(Grid1.Cells[3,1])*strtofloat(Grid1.Cells[3,6])*strtofloat(Grid1.Cells[3,8]));
    ang4:=(strtofloat(Grid1.Cells[4,1])+strtofloat(Grid1.Cells[4,6])+strtofloat(Grid1.Cells[4,8]));
    mag5:=(strtofloat(Grid1.Cells[3,2])*strtofloat(Grid1.Cells[3,4])*strtofloat(Grid1.Cells[3,9]));
    ang5:=(strtofloat(Grid1.Cells[4,2])+strtofloat(Grid1.Cells[4,4])+strtofloat(Grid1.Cells[4,9]));
    det4:=RoundTo(mag3*cos(degtorad(ang3)), -2);
    det41:=RoundTo(mag3*sin(degtorad(ang3)), -2);
    det5:=RoundTo(mag4*cos(degtorad(ang4)), -2);
    det51:=RoundTo(mag4*sin(degtorad(ang4)), -2);
    det6:=RoundTo(mag5*cos(degtorad(ang5)), -2);
    det61:=RoundTo(mag5*sin(degtorad(ang5)), -2);
    deter21:=det4+det4+det6;
    deter22:=det41+det51+det61;

    deterR:=deter11-deter21;
    deterI:=deter12-deter22;
    Edit1.Text:=floattostr(deterR);
    Edit2.Text:=floattostr(deterI);
  end;
end;

procedure TForm1.Button7Click(Sender: TObject);
var
  i:Integer;
begin
  for i := 1 to Grid1.RowCount - 1 do
    Grid1.Rows[i].Clear;
  Grid1.Cells[0,1]:='A';
end;

procedure TForm1.Button8Click(Sender: TObject);
begin
  Self.Close;
end;

procedure TForm1.Button9Click(Sender: TObject);
begin
  Grid2.ColCount:=Grid2.ColCount+1;
  Grid2.RowCount:=Grid2.RowCount+1;
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
  letra:=65;
  Grid1.Cells[1,0]:='Real';
  Grid1.Cells[2,0]:='Imag';
  Grid1.Cells[3,0]:='Magnitud';
  Grid1.Cells[4,0]:='Angulo';
  Grid1.Cells[0,1]:=chr(letra);
 oper:=0;
end;

end.

Última edición por ecfisa fecha: 07-07-2017 a las 04:50:13. Razón: Etiquetas [delphi] e identación
Responder Con Cita
  #2  
Antiguo 07-07-2017
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola Liz Beli, bienvenido a los foros de Club Delphi

Por favor, cuando incluyas código en tus mensajes, encierralo entre las etiquetas correspondientes como indica la imágen siguiente:

ya lo hice en tu mensaje.

También te aconsejo leer nuestra guía de estilo.

Saludos y gracias por tu colaboración
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita
  #3  
Antiguo 07-07-2017
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.267
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Hola y bienvenida a los foros.
Te recomiendo que revises la Guía de estilo para ver cómo realizar las preguntas.
Cita:
Empezado por Liz Beli Ver Mensaje
mi problema es que a la hora de correrlo el resultado no me lo da como si lo hicieras a amano por favor ayuda.
Nos tendrías que explicar "qué es lo que te da cuando lo haces a mano", para saber qué te tendría que dar cuando ejecutas el programa.

Cita:
Empezado por Liz Beli Ver Mensaje
Les dejo mi código:
En estos casos es mejor comprimir los fuentes del proyecto y ponerlos como adjunto, para que los usuarios puedan probarlo.
Si por permisos no puedes hacerlo, esta solución es buena, pero tienenque añadir también el contenido del DFM. De otra forma no podemos probarlo.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Crear matriz rebufo Varios 16 30-03-2011 18:56:02
cargar matriz corvarod Varios 2 09-03-2009 18:35:42
El proyecto Matriz poliburro La Taberna 1 03-11-2007 02:33:03
matriz editable jsanchez OOP 11 20-01-2006 15:28:41
matriz 3 dimensiones Lidia SQL 2 12-12-2005 18:59:58


La franja horaria es GMT +2. Ahora son las 03:19:06.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi