Ver Mensaje Individual
  #2  
Antiguo 07-06-2008
Avatar de xEsk
[xEsk] xEsk is offline
Miembro Premium
 
Registrado: feb 2006
Posts: 454
Reputación: 21
xEsk Va por buen camino
Hola, como no sé que quieres hacer con el resultado de "invertir", he hecho que se muestre con un ShowMessage.

Sería bueno que usaras las etiquetas de código DELPHI, así queda todo mucho mas bonito y claro
Código Delphi [-]
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    BitBtn1: TBitBtn;

    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

Function String_Reverse(S : String): String;
Var
  i : Integer;

Begin
  Result := '';
  For i := Length(S) DownTo 1 Do
    Begin
      Result := Result + Copy(S,i,1);
    End;
End;

procedure TForm1.BitBtn1Click(Sender: TObject);
VAR
  a,b,e:real;
  r:integer;

begin
  a:=strtofloat(inputbox('Datos','Introduzca numero A:',''));
  b:=strtofloat(inputbox('Datos','Introduzca numero B:',''));

  //parte a -----------------------------------------------------------
  e:=Exp(B*Ln(A));
  showmessage('Respuesta:'+' '+floattostr(e));

  //parte b ----------------------------------------------------------
  r:=(trunc(Int(A)) mod 4567);

  ShowMessage(String_Reverse(IntToStr(r)));

  //parte c ------------------------------------------------------------
  ShowMessage('Redondear B a las milésimas:'+FormatFloat('"Value = "0.000', b));
end;

end.

Te propongo otra forma de invertir un string, es muy similar:
Código Delphi [-]
function String_Reverse(s : String): String;
var
  i : Integer;

begin
  Result := '';
  for i:=1 to Length(s) do
    Result:=s[i] + Result;
end;

Saludos.
Responder Con Cita