Operator '^' ( power )
#1

Why this operator make addition ?
Reply
#2

e.g.:

pawn Код:
print("%d",2^4); // will result 6
Reply
#3

Quote:
Originally Posted by Angel φ
e.g.:

pawn Код:
print("%d",2^4); // will result 6
That won't result anything (it will display bad parameter count - 2, should be 1) because you're using normal print function which can't format placeholders like %d. Use printf function.
Reply
#4

RTFM, ^ isn't the power operator.
Reply
#5

ok Orb, but i don't get any error and in c# / c++ operator ^ means operator power ...
Reply
#6

In Pawn unfortunately it isn't, but there is floatpower().
Reply
#7

yes , i know this , but what about ******'s Encrypt System ? Why he used that operator ?

pawn Код:
public Encrypt(string[])
{
      for(new x=0; x < strlen(string); x++)
      {
            string[x] += (3^x) * (x % 15);
            if(string[x] > (0xff)) // 255
            {
                 string[x] -= 256;
            }
      }
      return 1;
}
Reply
#8

I don't think ****** wrote this shit.

^ IS an operator in Pawn, but not the power operator:
Quote:

e1 ^ e2 results in the bitwise “exclusive or” of e1 and e2.

Reply
#9

XOR operator for short.

Bitwise operators:

XOR = ^
AND = &
OR = |
NOT = ~
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)