Assignment operators in C++ are operators that are used to assign a value to a variable. C++ provides several assignment operators, which include:
Assignment operators can be used with various data types in C++, including integers, floating-point numbers, and characters. These operators are used extensively in programming to simplify code by performing arithmetic and assignment in a single step.
#include<iostream> using namespace std; int main() { int x=10; x+=5; cout<<"\nValue of x: "<<x; return 0; }To download raw file Click Here
Value of x: 15
#include<iostream> using namespace std; int main() { int x=10; x-=5; cout<<"\nValue of x: "<<x; return 0; }To download raw file Click Here
Value of x: 5
#include<iostream> using namespace std; int main() { int x=10; x*=5; cout<<"\nValue of x: "<<x; return 0; }To download raw file Click Here
Value of x: 50
#include<iostream> using namespace std; int main() { int x=10; x/=5; cout<<"\nValue of x: "<<x; return 0; }To download raw file Click Here
Value of x: 2
#include<iostream> using namespace std; int main() { int x=10; x%=5; cout<<"\nValue of x: "<<x; return 0; }To download raw file Click Here
Value of x: 0
#include<iostream> using namespace std; int main() { int x=10; x^=2; cout<<"\nValue of x: "<<x; return 0; }To download raw file Click Here
Value of x: 8
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions