TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: All
from: Roger Scudder
date: 2004-06-06 17:30:06
subject: RE: [C] C Puzzles

From: "Roger Scudder" 

On Saturday, June 05, 2004 1:55 PM, Bruce D. Wedding wrote:

> > > 4. Multiply x by 7 without using multiplication (*) operator.
> >
> > x = (x << 3) - x;

> I like that Roger.  I had done this less clever solution:

> x = (x << 2) +( x << 1) +  x;

As Darin pointed out, what looks clever on paper may not be so clever when
the constraints of a given system are applied.

> I'm working on the "remove dupes from array" problem.  And I think
people missed the one
> about f(7) = 4 and f(4) = 7.  It said show FOUR ways to do that.

Oh yeah, I was playing with the dupes question too.  I think it would make
a good candidate for a template with specialization for strings, UDTs,
etc... but then C doesn't support templates, does it?

-Roger

--- BBBS/LiI v4.01 Flag-5
* Origin: Prism's_Point (1:261/38.1)
SEEN-BY: 633/267 270
@PATH: 261/38 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.