float a = 10.3;
int b;
char c = 's'; //115 in ASCII
//USING IMPLICIT TYPECASTING
b = a / 2; //where the value of 'a' turned into int value
cout << b << endl;
cout << b + c << endl;
//USING EXPLICIT TYPECASTING
cout << (int) a + 8 << endl;
int main()
{
short a = 2000;
int b;
b = (int)a; // c-like cast notation
b = int(a); // functional notation
}
x = static_cast<decltype(x)>(y);
static_cast<int>(some_double);
int main()
{
int a=20 , b= 25 , c= 19;
int sum = a + b + c;
float ave = (float) sum / 3; //this is called type casting (float) sum
cout<<"Average is : "<<ave<<endl;
return 0;
}