Ver Mensaje Individual
  #8  
Antiguo 15-01-2008
Robert01 Robert01 is offline
Miembro
 
Registrado: feb 2006
Ubicación: Córdoba, Argentina
Posts: 895
Reputación: 19
Robert01 Va por buen camino
No heprobado los cálculos para ver si dan los valores correctos, probá así:

Código Delphi [-]
  public
    { Public declarations }
   x,y,fraccion,entero : single;
  end;

var
  Form1: TForm1;


implementation

{$R *.dfm}
procedure cal(var x : single; var y : single; var fraccion : single;var entero:single);
begin
entero:=trunc(x/y);
fraccion := y*frac(x/y);
end;

procedure TForm1.Button1Click(Sender: TObject);

begin

x:=strToFloat(Edit1.Text);
y:=strToFloat(Edit2.Text);

cal(x,y,fraccion,entero);

Edit3.Text:=floattoStr(entero);
Edit4.Text:=floattoStr(fraccion);

end;


Creo que anda bien

Saludos

Última edición por Robert01 fecha: 15-01-2008 a las 17:54:13. Razón: Se desordenó el código
Responder Con Cita