When I tried to perform the function of dividing one INTEGER:20 by another INTEGER:10, I always got the statment that the result is in REAL type instead of INTEGER as expected. what happened and How can I change the setting?
Thanks in advance!
Mailing lists / fpc-other / 2001-11
How can I change the variable value?
5 messages · 5 people · –
- DDu xiaobo 1
- JJonas Maebe 1
- MMarco van de Voort 1
- MMichael Wodrich 1
- NNoah silva 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Du xiaobo wroteWhen I tried to perform the function of dividing one INTEGER:20 by another INTEGER:10, I always got the statment that the result is in REAL type instead of INTEGER as expected. what happened and How can I change the setting?
Use "div" instead of "/", that will give you an integer result.
Jonas
When I tried to perform the function of dividing one INTEGER:20 by another INTEGER:10, I…
When I tried to perform the function of dividing one INTEGER:20 by another INTEGER:10, I always got the statment that the result is in REAL type instead of INTEGER as expected. what happened and How can I change the setting?
Use the integer divide operator "DIV" instead of the real operator /
When I tried to perform the function of dividing one INTEGER:20 by another INTEGER:10, I…
you have to use DIV instead of a /.
Think about it:
for example: 15 / 2 isn't an integer, even though 15 and 2 are both integers.
Du xiaobo wrote 11 lines
When I tried to perform the function of dividing one INTEGER:20 by
another INTEGER:10, I always got the statment that the result is in REAL
type instead of INTEGER as expected. what happened and How can I change
the setting?
Thanks in advance!
_______________________________________________
fpc-other maillist -
http://lists.freepascal.org/mailman/listinfo/fpc-other
von: Michael Wodrich
verfasst: 17.11.2001 20:51:57 (GMT+02.00)
Dividing two numbers results in a REAL number.
For this reason you MUST take DIV to get an INTEGER.
hth
Michael Wodrich
Noah silva schrieb am 16.11.2001:
Show quoted text 14 lines
Think about it:
for example: 15 / 2 isn't an integer, even though 15 and 2 are both
integers.
On Fri, 16 Nov 2001, Du xiaobo wrote:
> When I tried to perform the function of dividing one INTEGER:20 by
> another INTEGER:10, I always got the statment that the result is in
REAL
> type instead of INTEGER as expected. what happened and How can I
change
> the setting?
> Thanks in advance!
Programmieren, dass spannendste Detektivspiel der Welt.
