From: DFast@...

Date: Fri, 8 Nov 2002 14:59:26 -0800

Date: Fri, 8 Nov 2002 14:59:26 -0800

```
Yup! My fault! Thanks. The simplest...
When *I* write a program I do DIM all vars (and use HANDLEEVENT, etc), but
when you are working with kids that can't type, and are only in the class
for MATH credit, you concentrate on the simplest things like basic operator,
results, graphing, functionality, etc, and leave the better programming
habits for next semester when the chaff is weeded out. It is hard enough for
them to not make a typo and end up with a "0" result.
-----Original Message-----
From: Heather Donahue [mailto:maclists@...]
Sent: Friday, November 08, 2002 2:24 PM
To: futurebasic@...
Subject: Re: [FB] Question on Integer(%) and Long Integer(!)
I'm guessing no one answered this one.
On 11/7/02 2:48 PM, "DFast@..." <DFast@...> wrote:
>
> If you enter 75 divided by 7
>
> The first function (FN Intdiv) gives the correct answer: 10 remainder 5
> The second function (FN Intdiv2) gives the wrong answer: 11 remainder 5
> The third function (FN Intdiv3) gives the correct answer: 10 remainder 5
> The fourth function (FN Intdiv4) gives the correct answer: 10 remainder 5
> =========================================================
The reason FN IntDiv2 doesn't work is that you are using singles (!) not
long integers (&)
LOCAL FN IntDiv2
PRINT " INTEGER DIVISION"
PRINT : PRINT
PRINT "In The Equation Num1 / Num2 = Result"
PRINT
PRINT "Enter A WHOLE Number: ";
INPUT Intnum1&
PRINT "Enter A Second WHOLE Number: ";
INPUT Intnum2&
Result& = Intnum1& \\ Intnum2&
Rmndr& = Intnum1& MOD Intnum2&
PRINT : PRINT
PRINT USING " ###### "; Result&
PRINT " ______________"
PRINT USING " ###### |"; Intnum2&;
PRINT USING " ######"; Intnum1&
PRINT
PRINT USING " Remainder = ######";Rmndr&
PRINT
PRINT "< Rtn To Continue >"
INPUT AN$
END FN
Plus you should really DIM all your variables, and another reason why DIM AS
LONG is superior to DIM Intnum2&
--
To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>
```