Mail Archives: djgpp/1997/10/15/04:45:29
Mike wrote:
>Hi. I'm just a casual programmer, so excuse me if this is a foolish
>question. I cannot get the ^ operator to work in my programs using DJGPP. It
>returns error messages basically saying it doesn't know what it is. I'll try
>something like this:
> cout << 3^2;
>and it happens. Do I have to include some weird header file, or am I just
>screwed? Any help appreciated.
Mike,
In "C" ^ is the binary operator XOR. As it appears on the
surface I would think your code should work. But obviously it isn't working
for you. I might suggest that you try cout << (3^2); and see if that helps.
On the chance that you wanted 3 raised to the 2nd power, you'd want to look at
the function call pow(3, 2);
#include <math.h> pow(...) really expects two doubles to be passed to it and
returns a double, but I think this should work. Sorry for posting without
testing anything. Perhaps someone will be along and clarify the situation.
Sincerely,
Br5an AT aol DOT com
- Raw text -