Answers for "increment decrement"

C++
1

C++ Increment and Decrement

int b, a, e, d, c, f;
    int num = 57;
    cout << "The number is " << num << endl;

    b = ++num;
    a = ++num;
    e = a + 1;
    cout << "After post increment by 1, the number is " << b << endl;
    cout << "After pre increment by 1, the number is " << a << endl;
    cout << "After increasing by 1, the number is " << e << endl;

    d = --e;
    c = --e;
    f = c - 1;
    cout << "After post decrement by 1, the number is " << d << endl;
    cout << "After pre decrement by 1, the number is " << c << endl;
    cout << "After decreasing by 1, the number is " << f << endl;
Posted by: Guest on March-08-2022
0

increment and decrement operator

Increment Operators: The increment operator is used to increment the value of 
a variable in an expression. In the Pre-Increment, value is first incremented 
and then used inside the expression. Whereas in the Post-Increment, value is 
first used inside the expression and then incremented.

Decrement Operators: The decrement operator is used to decrement the value of 
a variable in an expression. In the Pre-Decrement, value is first decremented 
and then used inside the expression. Whereas in the Post-Decrement, value is 
first used inside the expression and then decremented.
Posted by: Guest on February-06-2022

Code answers related to "increment decrement"

Browse Popular Code Answers by Language