Autor Beitrag
Ghost40k
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Windows XP Pro x64 Edition
Delphi 2005,Html,ActionScript,Php etc
BeitragVerfasst: Do 18.01.07 23:32 
Also bis jetzt hat alles bei mir gefunzt, bis ich auf die idee gekommen bin : Hey, Das kann auch Minus sein ... , so jetzt hab ich eine Abfrage geschrieben ob meine Zahl zaehler <0 ist , wenn das so ist , soll er den zaehler mit -1 multiplizieren , dass er wieder Positiv wird:
Problem: entweder Programm hängt sich auf, oder das minus bleibt stehen ..
hat jemand ne idee?
Danke im Vorraus
mfG Ghost40k
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 18.01.07 23:39 
zeig doch mal 'n bischen code...

hab mir zwar bereits eine kristalkugel bestellt, diese ist jedoch noch nicht eingetroffen... und zum im trüben fischen, hab ich keinen bock.
Ghost40k Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Windows XP Pro x64 Edition
Delphi 2005,Html,ActionScript,Php etc
BeitragVerfasst: Do 18.01.07 23:41 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
if (br3.zaehler<0) then
begin
br3.zaehler:=(br3.zaehler*(-1));
    label16.visible:=true ;
    Label17.visible:=true ;
    Label18.visible:=true ;
    Label19.visible:=true ;
    Label20.visible:=true ;
    Label21.visible:=true ;
    Label22.visible:=true ;
    Label23.visible:=true ;
    Label24.visible:=true ;
    Label25.visible:=true ;

    end
else
  begin

    Label17.visible:=false ;
    Label18.visible:=false ;
    Label19.visible:=false ;
    Label20.visible:=false ;
    Label21.visible:=false ;
    Label22.visible:=false ;
    Label23.visible:=false ;
    Label24.visible:=false ;
    Label25.visible:=false ;
end;
end;

Im Prinzip ist das die Abfrage .. aber ich glaube die if abfrage will er nicht ..
Dragonclaw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Do 18.01.07 23:42 
Du kannst einfach den absolute Wert von X nehmen, das geht mit

ausblenden Delphi-Quelltext
1:
Zahl := abs(Zahl);					


fertig, da ist auch egal ob die Zahl < oder > 0 ist.
Ghost40k Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Windows XP Pro x64 Edition
Delphi 2005,Html,ActionScript,Php etc
BeitragVerfasst: Do 18.01.07 23:43 
Vorraus geht noch eine Subtraktion zweier Brüche , jedoch kann ja bei einer Subtraktion nur zaehler neg. sein ...
Ghost40k Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22

Windows XP Pro x64 Edition
Delphi 2005,Html,ActionScript,Php etc
BeitragVerfasst: Do 18.01.07 23:44 
^^ danke , und nein ist es nicht , da ich , wenn die Zahl kleiner ist , ein negatives vorzeichen bzw ein label dafür ausgeben muss =)
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 18.01.07 23:52 
@Ghost40k.. lass uns doch nicht im trüben fischen, bring doch mal 'n biserl mehr code und sag was du mit dem zähler und labels erreichen willst... was ich bisher gesehen hab, brauchst gar keine abfrage und kein subtrahieren... lurk mal unter findcomponents... hier im forum .. und dann die labels einfach umswitchen.. nach dem motto... label[i].visible := not label[i].visible...

<HTH>

PS: bei dem codesnipserl.. kann sich dein progy gar nicht aufhängen... post doch mal das relevante zeugs...
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Fr 19.01.07 07:09 
user profile iconGhost40k hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
if (br3.zaehler<0) then
begin
br3.zaehler:=(br3.zaehler*(-1));
    label16.visible:=true ;
    Label17.visible:=true ;
    Label18.visible:=true ;
    Label19.visible:=true ;
    Label20.visible:=true ;
    Label21.visible:=true ;
    Label22.visible:=true ;
    Label23.visible:=true ;
    Label24.visible:=true ;
    Label25.visible:=true ;

    end
else
  begin

    Label17.visible:=false ;
    Label18.visible:=false ;
    Label19.visible:=false ;
    Label20.visible:=false ;
    Label21.visible:=false ;
    Label22.visible:=false ;
    Label23.visible:=false ;
    Label24.visible:=false ;
    Label25.visible:=false ;
end;
end;

Im Prinzip ist das die Abfrage .. aber ich glaube die if abfrage will er nicht ..


dann machs doch so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
if (br3.zaehler<0) then
begin
    label16.visible:=true ;
    Label17.visible:=true ;
    Label18.visible:=true ;
    Label19.visible:=true ;
    Label20.visible:=true ;
    Label21.visible:=true ;
    Label22.visible:=true ;
    Label23.visible:=true ;
    Label24.visible:=true ;
    Label25.visible:=true ;
    end
else
  begin
    Label17.visible:=false ;
    Label18.visible:=false ;
    Label19.visible:=false ;
    Label20.visible:=false ;
    Label21.visible:=false ;
    Label22.visible:=false ;
    Label23.visible:=false ;
    Label24.visible:=false ;
    Label25.visible:=false ;
end;
br3.zaehler:=abs(br3.zaehler);
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Fr 19.01.07 07:26 
oder so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
var
  HF: Boolean;
begin
  HF := br3.zaehler<0;
  label16.visible := HF;
  Label17.visible := HF;
  Label18.visible := HF;
  Label19.visible := HF;
  Label20.visible := HF;
  Label21.visible := HF;
  Label22.visible := HF;
  Label23.visible := HF;
  Label24.visible := HF;
  Label25.visible := HF;
  br3.zaehler:=abs(br3.zaehler);
end;

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 19.01.07 08:56 
Oder so: ;-)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  i: Integer;
  HF: Boolean;
begin
  HF := br3.zaehler < 0;
  for i := 16 to 25 do
    TLabel(FindComponent('Label' + IntToStr(i))).Visible := HF;
  br3.zaehler := Abs(br3.zaehler);
end;
Allesquarks
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 510

Win XP Prof
Delphi 7 E
BeitragVerfasst: Fr 19.01.07 10:41 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
function _changesign(zahl:integer):integer;
asm
   not eax;
   inc eax;
end;


falls du nur das Vorzeichen wechseln möchtest und evt auch mal + => -