Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Calculate Min Max of integer (https://www.delphipraxis.net/144225-calculate-min-max-integer.html)

himitsu 3. Dez 2009 10:32

Re: Calculate Min Max of integer
 
Delphi-Quellcode:
procedure TMyInt.SetValue(IntValue: Integer);
begin
  if not FInit then
  begin
    FValue := IntValue;
    FMax := FValue;
    FMin := FValue;
    FInit := True;
  end
  else
    if FValue <> IntValue then
    begin
      FValue := IntValue;
      if FValue > FMax then
        FMax := FValue;
      if FValue < FMin then
        FMin := FValue;
    end;
end;
Delphi-Quellcode:
procedure TMyInt.SetValue(IntValue: Integer);
begin
  FValue := IntValue;
  if not FInit then begin
    FMax := FValue;
    FMin := FValue;
    FInit := True;
  end
  else if FValue > FMax then FMax := FValue
  else if FValue < FMin then FMin := FValue;
end;
I do not understand what he wants her more.
- the codes for TMyInt all work
- only the position of the variable, and that everything is constantly new initializes what the problem

Delphi-Quellcode:
procedure TForm3.Timer1Timer(Sender: TObject);
var
  temp: TMyInt; << this is not local, but must be
                    declared globally in the form
begin
  temp.Init;    << and it should not be constantly re-initialized


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:20 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz