DelphiBasics
FahrenheitToCelsius
Function
Convert a fahrenheit temperature into celsius StdConvs unit
 function FahrenheitToCelsius ( const FahrenheitValue : Double ) : Double;
Description
The FahrenheitToCelsius function converts a FahrenheitValue to celsius.
Related commands
CelsiusToFahrenheit Convert a celsius temperature into fahrenheit
Convert Convert one measurement value to another
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Convert body temperature in fahrenheit to celsius
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  StdConvs,   // Unit containing the FahrenheitToCelsius command
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  celsius, fahrenheit : Double;

begin
  // Define the fahrenheit value
  fahrenheit := 98.4;  // Human body temperature

  // Convert to celsius
  celsius := FahrenheitToCelsius(fahrenheit);

  // Show both values
  ShowMessageFmt('%f F  = %f C',[fahrenheit, celsius]);
end;
 
end.
Hide full unit code
   98.40 F = 36.89 C
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page