AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Calculate Min Max of integer

Ein Thema von nanix · begonnen am 2. Dez 2009 · letzter Beitrag vom 3. Dez 2009
Antwort Antwort
Seite 2 von 2     12   
Benutzerbild von himitsu
himitsu
Online

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.183 Beiträge
 
Delphi 12 Athens
 
#11

Re: Calculate Min Max of integer

  Alt 3. Dez 2009, 10:32
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
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:53 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz