# Intro To C++/Playing with operator

 Intro To C++ Variables Playing with operator Making statement

## Basic Math

C++ can be used to do basic math. The operators used in the basic math are listed in the table below.

Operator Operation
Arithmetic Operator ${\displaystyle +}$  addition
${\displaystyle -}$  Subtraction
${\displaystyle *}$  Multiplication
${\displaystyle /}$  Division
${\displaystyle \%}$  Modulus
${\displaystyle ++}$  Increment
${\displaystyle --}$  Decrement
Assignment Operator ${\displaystyle =}$  "${\displaystyle a=b}$ " is equivalent to "${\displaystyle a=b}$ "
${\displaystyle +=}$  "${\displaystyle a+=b}$ " is equivalent to "${\displaystyle a=a+b}$ "
${\displaystyle -=}$  "${\displaystyle a-=b}$ " is equivalent to "${\displaystyle a=a-b}$ "
${\displaystyle *=}$  "${\displaystyle a*=b}$ " is equivalent to "${\displaystyle a=a*b}$ "
${\displaystyle /=}$  "${\displaystyle a/=b}$ " is equivalent to "${\displaystyle a=a/b}$ "
${\displaystyle \%=}$  "${\displaystyle a\%=b}$ " is equivalent to "${\displaystyle a=a\%b}$ "
Comparison Operator ${\displaystyle ==}$  Equality
${\displaystyle !=}$  Inequality
${\displaystyle >}$  Greater than
${\displaystyle <}$  Less than
${\displaystyle >=}$  Greater than or equal to
${\displaystyle <=}$  Less than or equal to
Logical Operator ${\displaystyle \&\&}$  Logical AND
${\displaystyle ||}$  Logical OR
${\displaystyle !}$  Logical NOT

Basic math operators in C++ have some distinguishing features:

• Bulleted list item
• Bulleted list item
• Bulleted list item

Part of Basic math operation is demonstrated in the C++ program below:

```#include <iostream>;
using namespace std;

int main{
int a=4, b=9, c=0;
cout << "Multiplication result(a*b):"<<(a*b)<< endl;
cout << "Multiplication & assign: a *=b(4*9) a="<< a*=b << endl;
cout << "lesser comparision: a < b "<< (a<b) << "true"<< endl;
cout << "And logic: (a && a)" << (a && a) << "(true)" << endl;
}
```

## Checking Size

The memory size of any variable can be discovered using the C++ sizeof operation.The sizeof operator syntax is look like this:

sizeof(var)

The sizeof operator is demonstrated in the program as follows:

```#include <iostream>
using namespace std;

int main(){
}
```

## Casting Data Types

Any data-types except "string" could be converted to another data type through "casting". Casting syntax in C++ looks like this:

variable-name=static-cast <data-type> variable-name

Casting with C++ form is demonstrated in the program as follows:

```#include <iostream>
using namespace std;

int main(){
}
```