[Tutorial][Community]4.Level 1-4, operators


#1

by request i am adding this one, this is basically explaining how the math works

as you might have seen in the tutorials assignment is in reverse to what you might be used to
x = 10;
in this your assigning x the value of 10

you can do arithmetic with these

      • / %
        i hope i don’t have to explain addition, subdivision multiplication and devision
        but theres that one extra % modulo, it outputs the remainder of a division of two values
        ``x = 10 % 3;```
        10 divided by 3 is 3 with a remainder of 1

inside if statements you want to compare 2 values and see if there are true
if(x == 1)
== means equal to the opposite is != not equal to
we also have < less than and > greater than
<= less than or equal to and >= greater than or equal to

sometimes you want to test for more then one thing in the same if statement
if(x == 10 && y <= 3)
this is the and operator both statements needs to be true to run the block of code of this if statement
if(x == 10 || y <= 3)
we also have or in this case if one or the other is true it will run the block of code

#wip
how to explain operator precedence
http://en.cppreference.com/w/cpp/language/operator_precedence


#2

Yes, i know its a old post…

But i was searching information about the operators within C++ and although this did help i found this link better structured :

maybe to complex already but it helped me, so it is worth a thought.