000
29.01.2007, 17:42 Uhr
~Daaaniel
Gast
|
hi,
wie prüfe ich ob,eine Variable negativ ist? So hab ich angefangen,aber ohne Erfolg:
[cpp int b = -12; int c = 12; if(b == -b) { cout<<"Neg"; } else { cout<<"Pos"; }[/cpp]
Immer wenn ich das prüfe,erscheint in der Konsole "Neg"(für negativ),obwohl er auf "Pos"(für positiv) zeigen sollte. Ich hoffe,dass ihr mir helfen könnt
Daniel |