// Program to illustrate static_cast operator
#include<iostream.h>
void main()
{
     float val=34.21;
     int i=static_cast <int> (val);
     cout<<"\n The value of float variable is :"<<val;
     cout<<"\n The value of integer variable is:"<<i;
}
Test data
Output
The value of float variable is : 34.21
The value of integer variable is : 34