Re: Newbie question: it works, but what's it doing?
From: Zac Bond (zwb2_at_cwru.edu)
Date: 03/20/04
- Previous message: Legion: "Re: [C++] Binary Search Confusion SOLVED!"
- In reply to: Dan Moos: "Re: Newbie question: it works, but what's it doing?"
- Next in thread: Mrpants: "Re: Newbie question: it works, but what's it doing?"
- Reply: Mrpants: "Re: Newbie question: it works, but what's it doing?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 19 Mar 2004 22:24:40 -0500
"Dan Moos" <dan.moos@verizon.net> wrote in message
news:hKM6c.1765$Ec6.1153@nwrddc02.gnilink.net...
> > it does a 'mod' divide of (rand()+1) ( mod returns the remainder
of an
> > integer divide). as for the (3-1+1) i can never remember the
precedence
> > of this so i always use more '()' than i need to make sure -
((3-1)+1)
> > or (3-(1+1)). as you can see it does make a difference!
>
> Am I missing something? Addition works the same no matter how you
> paranthesise the statement
>
> (3-1+1) = (3-1)+1 = 3+(-1+1) = 3
>
> Is there something obvious I'm not seeing?
3-(1+1), if you are only changing parentheses. That being said, I
don't understand why the code uses "3-1+1" instead of just "3".
-Zac
- Previous message: Legion: "Re: [C++] Binary Search Confusion SOLVED!"
- In reply to: Dan Moos: "Re: Newbie question: it works, but what's it doing?"
- Next in thread: Mrpants: "Re: Newbie question: it works, but what's it doing?"
- Reply: Mrpants: "Re: Newbie question: it works, but what's it doing?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|