Examples of Increment and Decrement Operator:
![Examples of Increment and Decrement Operator in C++ Programming Language Examples of Increment and Decrement Operator in C++ Programming Language](https://blogger.googleusercontent.com/img/a/AVvXsEhUTVCnDLTNQfdjfW1GRCrDZ81eNEbiw4M8fhBZLp8PegiTDEfW4jQ1-nA8MlPgfUHkw3fhkxJFU2PWNivXWBn-JvKfr3Or6K9V2MQFDmfKP6K8gTOXoQXvZ0OyuFC11vEbvXDxQeOsEGP3bq93KFaj4B6HEtzWEpOou-5J-kaJbNP1AD8bAEIYjrG9=w640-h404) |
Examples of Increment and Decrement Operator in C++ Programming Language |
Output:
![Examples of Increment and Decrement Operator in C++ Programming Language Examples of Increment and Decrement Operator in C++ Programming Language](https://blogger.googleusercontent.com/img/a/AVvXsEjB28ZY0UUyAk0lOAs9BN1DkFOFzjiX1fL9lAhxfOyuyKCgax89gi2UZYtrDw3KcaqbLj2tEu2inS9m4_9XgA-COYLxn0ieAAdz2gymg7coYhHwMgZYy6mWMbXXXhLePs0nIH9xmg3cQU229qpca3QPCpOEsLvBQvxVLxmc9sCnO8XZCQydcZRXuUAS=w320-h113) |
Output |
Coding:
#include<iostream>
using namespace std;
int main(){
int count=22;
int total;
total = count++;
cout<<"Value of count++ is "<<total<<endl;
cout<<"Value of count is "<<count<<endl;
total= ++count;
cout<<"Value of ++count is "<<total<<endl;
}
Example 2:
coding:
#include<iostream>
using namespace std;
int main()
{
int x,i;
i=11;
x=i++;
cout<<"x: "<<x<<endl;
cout<<"i: "<<i<<endl;
}
Output:
0 Comments