Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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;
 
PREVIOUS NEXT
Tagged: #Increment #Decrement
ADD COMMENT
Topic
Name
9+5 =