Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   "Pilas y colas" II (https://www.clubdelphi.com/foros/showthread.php?t=94022)

Guanco 23-06-2019 03:22:01

"Pilas y colas" II
 
Buenas Noches amigos necesito de su ayuda en respecto con esto
necesito hacer un programa de menor o mayor que
ejm
del StringGrid "SG_NUMEROS" seleccionar los numeros mayores o menos de un umbral "5" y esos numero clasificarlos en un StringGrid para menores de 5 "SG_MENUMBRAL" y en otro StringGrid para mayores de 5"SG_MAYUMBRAL"

aca les dejo mi código de como voy

sin mas a que hacer referencia les deseo buenas noches

Código Delphi [-]

unit Unit1;

interface

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

type
  TipoPila = Record
              Dato: Array[1..4] of integer;
              Tope: 0..4;
             end;
  TipoPilaMen=Record
              Dato:Array [1..4] of integer;
              topemen:0..4;
              end;
    TipoPilaMay=Record
              Dato:Array [1..4] of integer;
              topemay:0..4;
              end;

  TForm1 = class(TForm)
    E_INGRESAR: TEdit;
    B_SALIR: TButton;
    B_AGREGAR: TButton;
    B_MOSTRAR: TButton;
    B_REINICIAR: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    SG_NUMEROS: TStringGrid;
    SG_MENUMBRAL: TStringGrid;
    SG_MAYUMBRAL: TStringGrid;
    E_UMBRAL: TEdit;
    B_UMBRAL: TButton;
    procedure B_REINICIARClick(Sender: TObject);
    procedure B_SALIRClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure B_AGREGARClick(Sender: TObject);
    procedure B_MOSTRARClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Pila:TipoPila;
  Pilamenor:TipoPilaMen;
  Pilamayor:TipoPilaMay;
  fila:integer;
  filamay:integer;
  filamen:integer;
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.B_REINICIARClick(Sender: TObject);
begin
begin
 Application.MainForm.Hide;
 WinExec(PChar(ParamStr(0)), SW_NORMAL);
 TerminateProcess(GetCurrentProcess, 0);
end;
end;

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

procedure TForm1.FormCreate(Sender: TObject);
begin
  Pila.Tope:=0;
  fila:=4;
  filamen:=4;
  filamay:=4;
end;

procedure TForm1.B_AGREGARClick(Sender: TObject);
begin
    If Pila.Tope<4 Then
   Begin
     E_INGRESAR.SetFocus;
     Pila.Tope:= Pila.Tope+1;
     Pila.dato[Pila.Tope]:=StrToInt(E_INGRESAR.text);
     SG_NUMEROS.Cells [0,fila-1]:= IntToStr(Pila.dato[Pila.Tope]);
     fila:=fila-1;
     E_INGRESAR.Clear;E_INGRESAR.SetFocus;
  end;

end;



procedure TForm1.B_MOSTRARClick(Sender: TObject);
   Begin
 If Pila.Tope<=4 Then
   Begin
     Pilamenor.topemen:= Pilamenor.topemen+1;
     Pilamenor.Dato[Pilamenor.topemen]:=Pila.dato[Pila.Tope];
     SG_MENUMBRAL.Cells [0,filamen-1]:= IntToStr(Pilamenor.Dato[Pilamenor.topemen]);
     filamen:=filamen-1;
     Pila.Tope:=Pila.Tope-1;
   end;
  If Pilamenor.topemen=4 then
   Begin
    Showmessage('Pila LLena');
   End;
end;

end.

Casimiro Notevi 23-06-2019 15:18:44

https://www.clubdelphi.com/foros/showthread.php?t=93989

Neftali [Germán.Estévez] 25-06-2019 11:42:03

Hola y bienvenido a los foros.
Antes de nada te recomiendo revisar la Guía de estilo y prestar a tención a cómo realizar las preguntas.

En cuanto a tu mensaje, intentar concretar un poco lo que necesitas.
No es muy cómodo para quien lee la pregunta revisar ese código y contestarte "algo".
Te recomiendo que pienses en cómo facilitarle las cosas a quien pueda leer tu mensaje. Trozos de código cortos y preguntas concretas.

Un saludo.


La franja horaria es GMT +2. Ahora son las 09:14:53.

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