ASSIGNMENTS
- An assignment is when you give a variable a value before it is used.
- Assignments are statements, just as variables
- Declaring a variable and assigning to it, can be done in one statement
This is how it is represented in code:
int length = 10; //length assign to the value 10
int width = 4; //width assign to the value 4
int area = (length * width); //calculate the area inside the variable directly
cout << “area = ” << area << endl; //display on the screen the area calculated before