use static_cast : static cast « Development « C++
- C++
- Development
- static cast
use static_cast

#include <iostream>
using namespace std;
int main()
{
int i;
float f;
f = 199.22;
i = static_cast<int> (f);
cout << i;
return 0;
}
Related examples in the same category