Hola Kurt!
KT> Does Visual C++ have a similar function? If so, in what header
KT> file is it located and what is the name of the function? If not,
KT> would someone please show me a function to determine the sign of a
KT> number which would return 1 if positive, 0 if zero, and -1 if
KT> negative...?
I think you are a little lazy Ļaren't you? The program is very easy.
try something like this (I haven't tested it and I have written it in here as
I'm thinking on it)
template
int sign(tipo x)
{
if (x>0) return(1);
if (x<0) return(-1);
if (x=0) return(0);
}
Using a Template you can use any type for the number to compare Ej:
char a;
int b;
float c;
sign(a);
sign(b);
sign(c);
You can call the function with any type of parameter.
KT> Thanks,
Not at all. ;)
KT> kjt
What do you mean "kjt"? :-? :-P
Un saludo
Rafa
--- FMail 1.02
---------------
* Origin: Yo mismo y mi mecanismo. 93:341/736.96 (2:341/136.96)
|