Learn More

Wednesday, September 7, 2011

Operator Mostly Used

Ok, again we are talking about c + +, this time we continue with the operator in c + +. The most important part of a program. For those of you a physicist, knowledge of the operators is important in making a program, it also applies even if you're a game maker. We gave a list of frequently used operators. Actually there are many operators, you may not see it here, but maybe in the next tutorial you will find it.

operator table of c++

One that you have noticed, some operators read from left to right, some others read from right to left. For example operators: assignment, conditional, type casting, Increase, Decrease, bit inversion, boolean inverse; works by reading from right to left. For practice, try the code below by using c++ software.

  1. Probably, it is good to add the following explanation.

    The differentiate between n++ and ++n (and also n-- and --n):

    n++ will return the value of n first, then increments itself by 1, e.g:

    int n = 8;
    cout << n++ << endl;
    cout << n << endl;

    will print:
    8
    9

    but ++n will do the opposite. it will increment itself by 1 first, then return the value.

    int n = 8;
    cout << ++n << endl;
    cout << n << endl;

    will print:
    9
    9

    ReplyDelete
    Replies
    1. For Muhammad Alvin:
      Thank you for your share. When we want to create this post I want to do that. But if we do that at this post then I broken our rules. One of them is give step by step for each tutorial. In the next time we will try to give more clearly again. Thank you Alvin

      Delete