delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/15/04:45:29

From: br5an AT aol DOT com (Br5an)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ' ^ '
Date: 15 Oct 1997 04:36:44 GMT
Lines: 23
Message-ID: <19971015043601.AAA19454@ladder01.news.aol.com>
NNTP-Posting-Host: ladder01.news.aol.com
Organization: AOL http://www.aol.com
References: <621df9$cp9 AT camel12 DOT mindspring DOT com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019