TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: KURT J. TISCHER
from: PETER HAYWOOD
date: 1997-08-09 12:58:00
subject: Re: Signs of numbers

Groovy hepcat Kurt J. Tischer jived with All on 08 Jul 97  01:06:00!
Signs of numbers's a cool scene. Dig it!
 KJT> functions uses a function internal to VB called Sgn, which returns an
 KJT> integer (1, 0, or -1) corresponding to the sign of a number. (e.g.  
 KJT> numSign = Sgn(numSign)   ) 
 KJT> Does Visual C++ have a similar function?  If so, in what header
  Use the ?: operator, for example:
int s, i;
i = -647;       /* set i to some value */
s = (i =0 */
  You could even define a simple macro to perform the same task as
your VB function:
#define Sgn(x) (x  0 ? 1 : 0)
Then use the macro like this:
int s, i;
i = 8100        /* set i to some value */
s = Sgn(i);     /* get the sign of i */
                                                  Wolvaen
... Basic programmers never die. They just GOSUB without RETURN!
--- Blue Wave/RA v2.20
---------------
* Origin: The Gate, Melbourne Australia, +61-3-9809-5097 33.6k (3:633/159)

SOURCE: echomail via exec-pc

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™.