Operator types (four classes)
One, arithmetic operators:
a:++--B: */% c: +-
Note: 1. When doing a division, if two numbers are integers, the result is an integer, not a decimal.
2. The above operations, if the two operands are not a type, will be automatically converted at the time of operation
3. Order of operations: first operation a type, then B type, and finally C type (the following operators operate in the same order)
Use of surplus (%):
1. Can be used to determine whether an integer, the remainder is 0 o'clock, is an integer
2. A number used to turn a number into a range
Operations of a++ and ++a
a++: int a=4 b=a++
Console.WriteLine ("A=" +a);
Console.WriteLine ("b=" +b); Result: a=5,b=4 executes b=a, then executes a++ (i.e. a=a+1) when the operation is performed
++a:int a=4 B=++a
Console.WriteLine ("A=" +a);
Console.WriteLine ("b=" +b); Result: A=5,b=5 performs ++a (that is, a=a+1) when the operation is performed, and then executes B=a
Example one:
Example Two
two, relational operators : A. > < >= <= B. == !=
logic operator :a.&& logic and b. | | Logical OR C.! Logical Non-
iv. assignment operator := + = = *=/= * /
C # Programming--operators (arithmetic operators)