Autor Beitrag
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Di 11.03.03 21:05 
Hallo,
wie kann ich herausfinden ob 1 eine ungerade zahl ist oder nicht ?

_________________
MFG
Michael Springwald, "kann kein englisch...."
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Di 11.03.03 21:10 
habs geschaft;)

_________________
MFG
Michael Springwald, "kann kein englisch...."
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Di 11.03.03 21:12 
Häää?

ausblenden Quelltext
1:
2:
3:
4:
if 1 mod 2 = 0 then
  ShowMessage('Gerade')
else
  ShowMessage('Ungerade');


So! :) Also "Ungerade" kommt bei mir raus *g*

_________________
Viele Grüße
Jakob
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 11.03.03 21:13 
das geht doch besser mit ODD !!!

_________________
In the beginning was the word.
And the word was content-type: text/plain.
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Di 11.03.03 21:14 
verdammt, odd gibts ja auch noch *schäm*

_________________
Viele Grüße
Jakob
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 11.03.03 21:16 
jaaaaaaaa *freude*

ist mir auch spontan eingefallen !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Di 11.03.03 21:18 
ich habe es so gemacht:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
str:String;
begin
  str:=FloatToStr(Item.index / 2);

  if pos(',5',str) = 0 then
    ListView2.Canvas.Brush.Color:=clRed
  else
    ListView2.Canvas.Brush.Color:=clLime

_________________
MFG
Michael Springwald, "kann kein englisch...."
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Di 11.03.03 21:40 
@mimi, wolltest du nun wissen, ob deine zahl gerade oder vielleicht eher ganz ist? Das würde deine lösung erklären.

Gruß
Ken
mars
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 238

Debian Woody, Win 2000, Win XP
D7 Ent, Kylix 3
BeitragVerfasst: Di 11.03.03 21:42 
ne, das ist schon richtig, aber nicht sehr elegant :wink: . Die oberen Methoden wären einiges ästhetischer...
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Di 11.03.03 21:59 
schon da hast du recht, aber die ist mir so spotan eingefallen;)
(hätte nicht gedacht, das es so ein großes thema wird;))

_________________
MFG
Michael Springwald, "kann kein englisch...."
kiwicht
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Mi 12.03.03 09:22 
und wer erklär jetztnochma ODD bitte?
Modulo kennt man ja, aber ODD?

thx
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Mi 12.03.03 17:02 
hä ?
was meinst du mit ODD ?

_________________
MFG
Michael Springwald, "kann kein englisch...."
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Mi 12.03.03 18:42 
das dürfte für Klarheit sorgen:

Zitat:
Die Funktion gibt true zurück, wenn das Argument eine ungerade Zahl ist.

Unit

System

Kategorie

Ganzzahlarithmetik

Delphi-Syntax:

function Odd(X: Longint): Boolean;

Beschreibung

In Delphi prüft Odd, ob der mit X angegebene Wert eine ungerade Zahl ist. Bei einer ungeraden Zahl wird true zurückgegeben, bei einer geraden false.

_________________
Viele Grüße
Jakob
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Mi 12.03.03 19:16 
so eine funktion gitb es schon ?
(hätte ich nicht gedacht;))
danke, hätte wirklich nicht gedacht das diese simply frage zu einer disk wird;)

_________________
MFG
Michael Springwald, "kann kein englisch...."