Nevermind, I just found out that & instead of && does what I want.
Replicating AND OR XOR SmileBASIC functions
Root / Programming Questions / [.]
jamieyelloCreated:
I want to replicate them in c++, c++ has && and ||, but those only return binary 1 or 0. Also, if you do
if 1 AND 2 THEN PRINT "Print stuff"
In SB, the result is 0, so nothing is printed. In c++ if you do
if (1 && 2){ cout << "Print stuff"; }
It activates, because both one and two are above zero which makes them both "true". (1 && 2) comes back as 1 instead of 0 which is how it was in SB. If I did
cout << (4 && 5)*5;
It would print 5. in SmileBASIC
PRINT (4 AND 5)*5
gives 20. I'm not sure how to replicate that. I know how it works on a binary level but I don't know if c++ has some kind of operator that does that.