Autor Beitrag
ck3009
Hält's aus hier
Beiträge: 13

Win95, Win98, Win2000 Prof.
Delphi 3 Prof., 7,
BeitragVerfasst: Di 17.02.04 09:39 
Hallo Leute ich möchte einen Real Wert von der Variablen "Anzahl" in eine andere Variable "Anzahl2" die ein Integer ist den Wert übertragen!!!

Ich finde einfach keine Lösung

Helft mir bitte :wink:
Sven
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 314


D6 Ent, K3 Pro (patched)
BeitragVerfasst: Di 17.02.04 09:55 
Wie wärs mit:

ausblenden Delphi-Quelltext
1:
Anzahl2 := Round(Anzahl)					

_________________
MDK 9.1, Kernel 2.4.21, KDE 3.1 Kylix 3 Pro (patched), nutze aber auch Windows
waldmeister
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 136

Win XP
D7 Enterp
BeitragVerfasst: Di 17.02.04 12:31 
oder auch mit

ausblenden Delphi-Quelltext
1:
Anzahl2 := Trunc(Anzahl);					

_________________
der wald....der meister....der meister des waldes....der waldmeister
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Di 17.02.04 21:28 
Vorsicht!
Trunc != Round
Es kommt drauf an zu welchem Zweck man Anzahl2 braucht. Trunc schneidet einfach nur die Dezimalstellen ab, 5,9 wird zu 5. Round rundet hingegen, 5,9 wird zu 6.

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
catweasel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 487
Erhaltene Danke: 1

Win 7 64bit
Delphi 7 Second Sedition V7.2
BeitragVerfasst: Di 17.02.04 23:04 
Zitat:
Round rundet hingegen,

...Wobei noch zu erwähnen bleibt, dass Round() nach dem "American Banker's Round" Schema rundet, was nicht gleich unserem "kaufmännischem Runden" ist.........

Catweasel

_________________
Pommes werden schneller fertig wenn man sie vor dem Frittieren einige Minuten in siedendes Fett legt.