Examples of Increment and Decrement Operator in C++ Programming Language

 

Examples of Increment and Decrement Operator in C++ Programming Language

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


Output:

Examples of Increment and Decrement Operator in C++ Programming Language
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:
Examples of Increment and Decrement Operator in C++ Programming Language


Post a Comment

0 Comments