How we can use assignment operator in c++ code


Assignment operator is that to assign the value of one object of another object. The symbol of assignment operator is '=' .
First we make to objects num1 and num2, and than input object num1, and than use assignment operator between num2 and num1, and than cout the object num2. Than you can watch that the value of object num1 assign to object num2. So, you can read code below to understand the use of assignment operator. 


Code:

#include <iostream>
using namespace std;
int main() {
 int num1,num2;
 cout<<"Enter first number : ";
 cin>>num1;
 num2=num1;
 cout<<"Num2 : "<<num2;
}

Output:

Enter first number : 4
Num2 : 4

So, you can see the assignment of the value of object one of object two.

Click here for watch the video of that code 

avatar
AUTHOR: Muhammad Abbas
I am Software Engineer.

0 Comments