#include<iostream>usingnamespacestd;intmain(){inta=0,b=1;cout<<"———————————————————————————————————————————";cout<<"\nProgram to perform the assignment operations ";cout<<"\n———————————————————————————————————————————";cout<<"\nValue of a | "<<a;cout<<"\nValue of b | "<<b;cout<<"\nValue of "<<a<<" += "<<b<<" | "<<(a+=b);cout<<"\nValue of "<<a<<" -= "<<b<<" | "<<(a-=b);cout<<"\nValue of "<<a<<" *= "<<b<<" | "<<(a*=b);cout<<"\nValue of "<<a<<" /= "<<b<<" | "<<(a/=b);cout<<"\nValue of "<<a<<" %= "<<b<<" | "<<(a%=b);cout<<"\nValue of "<<a<<" ^= "<<b<<" | "<<(a^=b);cout<<"\nValue of "<<a<<" |= "<<b<<" | "<<(a|=b);cout<<"\nValue of "<<a<<" &= "<<b<<" | "<<(a&=b);cout<<"\n———————————————————————————————————————————\n";return0;}
Output
codeaft@codeaft:~$ g++ codeaft.cpp codeaft@codeaft:~$ ./a.out
———————————————————————————————————————————
Program to perform the assignment operations
———————————————————————————————————————————
Value of a | 0
Value of b | 1
Value of 0 += 1 | 1
Value of 1 -= 1 | 0
Value of 0 *= 1 | 0
Value of 0 /= 1 | 0
Value of 0 %= 1 | 0
Value of 0 ^= 1 | 1
Value of 1 |= 1 | 1
Value of 1 &= 1 | 1
———————————————————————————————————————————
codeaft@codeaft:~$
Dear User, Thank you for visitng Codeaft. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.