cast as an int c++ code example
Example 1: casting C++
int main()
{
short a = 2000;
int b;
b = (int)a; // c-like cast notation
b = int(a); // functional notation
}
Example 2: casting to a double in c++
double x;
x = (double) 25;
int main()
{
short a = 2000;
int b;
b = (int)a; // c-like cast notation
b = int(a); // functional notation
}
double x;
x = (double) 25;